simple geometric model

:EXPORT_FILE_NAME: simple_geometric_model

description of all variables

labeled_cartoon.png
\begin{equation} F=\sigma\left(S_{0}+S_{m}+S_{i}\right)+\frac{K}{2} S_{i}\left(\frac{2}{R_{i}}-2C_{i}\right)^{2}+\gamma_{d} S_{d}-\gamma_{m} S_{m}-\gamma_{i} S_{i}+P V_{i} \end{equation}
description value units reference type python variable associated equation LaTeX variable
invagination height   \(nm\)   input (variable) H_i   \(H_{i}\)
membrane tension 0.001 \(pN/nm\) (Hassinger et al. 2017) fixed sigma   \(\sigma\)
total plane radius 2000 \(nm\)   fixed A_t   \(A_{t}\)
final vesicle radius 50 \(nm\) (Kaksonen and Roux 2018) fixed vesicle_radius   \(R_{v}\)
coat bending rigidity 160 \(pN nm\) (Dmitrieff and Nédélec 2015) fixed K   \(K\)
spontaneous curvature 1/50 \(nm^{-1}\) (Hassinger et al. 2017) fixed C_i   \(C_{i}\)
droplet-cytosol surface tension 0.005 \(pN/nm\) (Jawerth et al. 2018) fixed gamma_d   \(\gamma_{d}\)
droplet-membrane wetting tension 0.002 \(pN/nm\)   fixed gamma_m   \(\gamma_{m}\)
initial droplet plane radius       fixed      
droplet-invagination surface tension 0.002 \(pN/nm\)   fixed gamma_i   \(\gamma_{i}\)
turgor pressure 0.1 \(pN/nm^2\) (Ma and Berro 2019) fixed P   \(P\)
relative invagination height   unitless   input (variable) h rel-h \(h\)
droplet volume   \(nm^3\)   intermediate output V_d   \(V_{d}\)
invagination surface area   \(nm^2\)   intermediate output S_i invagination-area \(S_{i}\)
initial droplet spherical radius 600 \(nm\)   intermediate output drop_radius    
droplet-flat membrane contact area   \(nm^2\)   intermediate output S_m md-area \(S_{m}\)
invagination spherical radius   \(nm\)   intermediate output R_i invagination-radius \(R_{i}\)
droplet-cytosol contact area   \(nm^2\)   intermediate output S_d dc-contact-area \(S_{d}\)
droplet contact angle   rad   intermediate output theta_d droplet-contact-angle \(\theta_{d}\)
invagination contact angle   rad   intermediate output theta_i invagination-angle \(\theta_{i}\)
invagination plane radius   \(nm\)   intermediate output A_i invagination-plane-radius \(A_{i}\)
droplet + invagination plane radius   \(nm\)   intermediate output A_d droplet-plane-radius \(A_{d}\)
outside membrane surface area   \(nm^2\)   intermediate output S_o outside-membrane-area \(S_{o}\)
invagination volume   \(nm^3\)   intermediate output V_i invagination-volume \(V_{i}\)
droplet + invagination volume   \(nm^3\)   intermediate output V_b di-volume \(V_{b}\)
droplet + invagination height   \(nm\)   intermediate output H_d di-height \(H_{d}\)
droplet + invagination spherical radius   \(nm\)   intermediate output R_d di-cap-radius \(R_{d}\)
free energy   \(pN \cdot nm\)   output F f-forces f-shapes \(F\)
membrane tension energy   \(pN \cdot nm\)   output membrane_tension    
bending energy   \(pN \cdot nm\)   output bending_energy    
surface tension energy   \(pN \cdot nm\)   output surface_tension    
wetting energy   \(pN \cdot nm\)   output wetting_energy    
turgor pressure energy   \(pN \cdot nm\)   output turgor_pressure    
membrane curvature   \(nm^{-1}\)   output 2÷R_i    

4.114 \(pN \cdot nm\) = 1 \(k_{B}T\) (“kT (Energy)” 2021)

references

Dmitrieff, Serge, and François Nédélec. 2015. “Membrane Mechanics of Endocytosis in Cells with Turgor.” PLoS Computational Biology 11 (10). doi:10.1371/journal.pcbi.1004538.
Hassinger, Julian E., George Oster, David G. Drubin, and Padmini Rangamani. 2017. “Design Principles for Robust Vesiculation in Clathrin-Mediated Endocytosis.” Proceedings of the National Academy of Sciences, January, 201617705. doi:10.1073/pnas.1617705114.
Jawerth, Louise M., Mahdiye Ijavi, Martine Ruer, Shambaditya Saha, Marcus Jahnel, Anthony A. Hyman, Frank Jülicher, and Elisabeth Fischer-Friedrich. 2018. “Salt-Dependent Rheology and Surface Tension of Protein Condensates Using Optical Traps.” Physical Review Letters 121 (25): 258101. doi:10.1103/PhysRevLett.121.258101.
Kaksonen, Marko, and Aurélien Roux. 2018. “Mechanisms of Clathrin-Mediated Endocytosis.” Nature Reviews Molecular Cell Biology, February. doi:10.1038/nrm.2017.132.
“kT (Energy).” 2021. Wikipedia, January.
Ma, Rui, and Julien Berro. 2019. “Mechanics of Membrane Internalization against Osmotic Pressure: Boundary Conditions Make a Difference.” Biorxiv, February, 558890. doi:10.1101/558890.
“Python - Spherical Coordinates Plot in Matplotlib.” n.d. Stack Overflow. https://stackoverflow.com/questions/36816537/spherical-coordinates-plot-in-matplotlib.
NO_ITEM_DATA:ma_endocytosis_2019

equations

summary

labeled_cartoon.png

arranged by force contributions:

F = membrane tension + bending energy + droplet-cytosol surface tension -
droplet-membrane surface tension - droplet-invagination surface tension + turgor
pressure 
\begin{equation} \label{ F=\sigma\left(S_{o}+S_{m}+S_{i}\right)+\frac{K}{2} S_{i}\left(\frac{2}{R_{i}}-2C_{i}\right)^{2}+\gamma_{d} S_{d}-\gamma_{m} S_{m}-\gamma_{i} S_{i}+P V_{i} \end{equation} \begin{equation} F=\sigma\left(S_{o}+S_{m}+S_{i}\right)+\frac{K}{2} S_{i}\left(\frac{2}{R_{i}}-2C_{i}\right)^{2}+\gamma_{d} S_{d}-\gamma_{m} S_{m}-\gamma_{i} S_{i}+P V_{i} \end{equation}

rearranged by shapes:

\begin{equation} F= \sigma S_{o} + \left(\sigma - \gamma_{m} \right) S_{m} + \gamma_{d} S_{d} + \frac{K}{2} S_{i} \left(\frac{2}{R_{i}} - 2 C_{i}\right)^{2} + P V_{i} + \left(\sigma - \gamma_{i} \right) S_{i} \end{equation}

broken down to shape functions and constant \(C\):

\begin{equation} F(\Delta S_{o}, \Delta S_{m}, S_{d}, R_{i}, V_{i})= F_{1}(\Delta S_{o}) + F_{2}(\Delta S_{m}) + F_{3}(S_{d}) + F_{4}(R_{i}) + F_{5}(V_{i}) + C \end{equation} \begin{equation} F_{1}(\Delta S_{o}) = \sigma \Delta S_{o} \end{equation} \begin{equation} \Delta S_{o}=\alpha \left(\frac{S_{i}^{3 / 2}}{\sqrt{\pi}}\left(\frac{3}{2} h-h^{3}\right)+3 V_{d}\right)^{2/3} \end{equation} \begin{equation} \label{alpha} \alpha = - \left(\frac{\pi\left(\frac{\gamma_{m}}{\gamma_{d}}+1\right)^{3}} {\left(-\frac{\gamma_{m}}{\gamma_{d}}+1\right)\left(\frac{\gamma_{m}}{\gamma_{d}}+2\right)^{2}}\right)^{1 / 3} \end{equation} \begin{equation} \label{} F_{2}(\Delta S_{m}) = \left(\sigma - \gamma_{m} \right) \Delta S_{m} \end{equation} \begin{equation} \Delta S_{m}= - \alpha \left(\frac{S_{i}^{3 / 2}}{\sqrt{\pi}}\left(\frac{3}{2} h-h^{3}\right)+3 V_{d}\right)^{2/3} + S_{i} h^{2} \end{equation} \begin{equation} \label{} F_{3}(S_{d}) = \gamma_{d} S_{d} \end{equation} \begin{equation} S_{d}=\epsilon \left(\frac{S_{i}^{3 / 2}}{\sqrt{\pi}}\left(\frac{3}{2} h-h^{3}\right)+3 V_{d}\right)^{2/3} \end{equation} \begin{equation} \epsilon = \left(\frac{8 \pi}{\left(-\frac{\gamma_{m}}{\gamma_{d}}+1\right) \left(\frac{\gamma_{m}}{\gamma_{d}}+2\right)^{2}}\right)^{1 / 3} \end{equation} \begin{equation} \label{} \begin{array}{l} F_{4}(R_{i}) = \frac{K}{2} S_{i} \left(\frac{2}{R_{i}} - 2 C_{i}\right)^{2} \end{array} \end{equation} \begin{equation} R_{i} = \frac{\sqrt{S_i}}{2 \sqrt{\pi } h} \end{equation} \begin{equation} \label{} F_{4}(h) = 2 K \left(C_i \sqrt{S_i}-2 \sqrt{\pi } h\right)^{2} \end{equation} \begin{equation} \label{} F_{5}(V_{i}) = P V_{i} \end{equation} \begin{equation} \label{} V_{i}=\eta \left(3 h-2 h^{3}\right) \end{equation} \begin{equation} \label{} \eta=\frac{S_i^{3/2}}{6 \sqrt{\pi }} \end{equation} \begin{equation} \label{} C = \sigma \pi A_t^2+S_i \left(\gamma _m-\gamma _i\right) \end{equation}

all combined into full free energy equation:

\begin{equation} F(h)=\left(\gamma_{m} \alpha+\gamma_{d} \epsilon\right)\left(\frac{S_{i}^{3 / 2}}{\sqrt{\pi}}\left(\frac{3}{2} h-h^{3}\right)+3 V_{d}\right)^{2/3}+\left(\sigma-\gamma_{m}\right) S_{i} h^{2} +2 K\left(C_{i} \sqrt{S}_{i}-2 \sqrt{\pi} h\right)^{2}+P \eta \left(3 h-2 h^{3}\right)+C \end{equation}

expanded polynomial:

\begin{equation} F(h)= \left(\gamma_{m} \alpha+\gamma_{d} \epsilon\right) \left(\frac{S_{i}^{3 / 2}}{\sqrt{\pi}}\left(\frac{3}{2} h-h^{3}\right)+3 V_{d}\right)^{2/3} - 2 P \eta h^{3}+\left(\left(\sigma-\gamma_{m}\right) S_{i}+8 K \pi\right) h^{2} +\left(3 P \eta-8 K C_{i} \sqrt{\pi S_{i}}\right) h+B \end{equation} \begin{equation} B=C+2 K C_{i}^{2} S_{i} \end{equation}

individual shape solutions

relative invagination height

h.jpg
\begin{equation} \label{rel-h} h = \frac{H_{i}}{\left(\frac{S_{i}}{\pi}\right)^{1/2}} \end{equation} \begin{equation} H_{i} = h \left(\frac{S_{i}}{\pi}\right)^{1/2} \end{equation}

droplet-membrane contact angle

2020-09-21_19-17-56_screenshot.png
Figure 1: contact angle cartoon contact-angle
\begin{equation} \begin{array}{l} \gamma_{S G}=\gamma_{S L}+\gamma_{L G} \cos \theta \\ \sigma+\gamma_{m}=\sigma+\gamma_{d} \cos \theta_{d} \\ \cos \theta_{d}=\frac{\gamma_{m}}{\gamma_{d}} \\ \sin \theta_{d}=\sqrt{1 - \cos \theta_{d}^{2}} \\ \sin \theta_{d}=\sqrt{1 - (\frac{\gamma_{m}}{\gamma_{d}})^{2}} \end{array} \end{equation} \begin{equation} \label{droplet-contact-angle} \theta_{d}=\arccos \left(\frac{\gamma_{m}}{\gamma_{d}}\right) \end{equation}

outside membrane area

\begin{equation} \label{outside-membrane-area} S_{0}=\pi\left(A_{t}^{2}-A_{d}^{2}\right) \end{equation}

circular plane radii

\begin{equation} \begin{array}{l} \sin \theta=\frac{a}{r} \\ a=r \sin \theta} \\ A_{i}=R_{i} \sin \theta_{i} \end{array} \end{equation} \begin{equation} \label{droplet-plane-radius} A_{d}=R_{d} \sin \theta_{d} \end{equation}

droplet-cytosol contact area

\begin{equation} \label{dc-contact-area} \begin{array}{l} A=2 \pi r^{2}(1-\cos \theta) \\ S_{d}=2 \pi R_{d}^{2}\left(1-\cos \theta_{d}\right) \end{array} \end{equation}

invagination surface area

\begin{equation} \label{invagination-area} S_{i}=4 \pi R_{v}^{2} \end{equation}

invagination volume

\begin{equation} \label{invagination-volume-a-h} \begin{array}{l} V=\frac{1}{6} \pi h\left(3 a^{2}+h^{2}\right) \\ V_{i}=\frac{1}{6} \pi H_{i}\left(3 A_{i}^{2}+H_{i}^{2}\right) \end{array} \end{equation}

alternately:

\begin{equation} \label{invagination-volume} \begin{array}{l} V=\frac{\pi}{3} h^{2} \left(3 r - h \right) \\ V_{i}=\frac{\pi}{3} H_{i}^{2} \left(3 R_{i} - H_{i} \right) \end{array} \end{equation}

invagination plane radius

\begin{equation} \begin{array}{l} A=\pi\left(a^{2}+h^{2}\right) \\ S_{i}=\pi\left(A_{i}^{2}+H_{i}^{2}\right) \\ A_{i}=\sqrt{\frac{S_{i}}{\pi}-H_{i}^{2}} \end{array} \end{equation} \begin{equation} \label{invagination-plane-radius} A_{i}=\sqrt{\frac{S_{i}}{\pi} \left(1 - h^{2}\right)} \end{equation}

invagination radius

\begin{equation} \label{invagination-radius} \begin{aligned} A &=2 \pi r h \\ S_{i} &=2 \pi R_{i} H_{i} \\ R_{i} &=\frac{S_{i}}{2 \pi H_{i}} \end{aligned} \end{equation}

invagination contact angle

\begin{equation} \label{invagination-angle} \begin{array}{l} S_{i}=2 \pi R_{i}^{2}\left(1-\cos \theta_{i}\right) \\ \theta_{i}=\arccos \left(1-\frac{S_{i}}{2 \pi R_{i}^{2}}\right) \end{array} \end{equation}

TODO droplet volume

  • should depend on initial plane radius

    \begin{equation} \label{d-volume} V_{b}=V_{d}+V_{i} \end{equation}

droplet + invagination volume

\begin{equation} \label{di-volume} V_{b}=V_{d}+V_{i} \end{equation}

droplet + invagination spherical cap radius

\begin{equation} \label{di-cap-radius} \begin{array}{l} V=\frac{\pi}{3} r^{3}(2+\cos \theta)(1-\cos \theta)^{2} \\ V_{b}=\frac{\pi}{3} R_{d}^{3}\left(2+\cos \theta_{d}\right)\left(1-\cos \theta_{d}\right)^{2} \\ R_{d}=\left(\frac{3 V_{b}}{\pi\left(2+\cos \theta_{d}\right)\left(1-\cos \theta_{d}\right)^{2}}\right)^{1 / 3} \end{array} \end{equation}

droplet + invagination height

\begin{equation} \label{di-height} \begin{array}{l} A=2\pi r h \\ S_{d}=2\pi R_{d} H_{d} \\ H_{d}=\frac{S_{d}}{2 \pi R_{d}} \end{array} \end{equation}

flat membrane-droplet contact area

\begin{equation} \label{md-area} S_{m}=\pi\left(A_{d}^{2}-A_{i}^{2}\right) \end{equation}

separate force components (original version)

\begin{equation} \label{f-forces} F=\sigma\left(S_{o}+S_{m}+S_{i}\right)+\frac{K}{2} S_{i}\left(\frac{2}{R_{i}}-2C_{i}\right)^{2}+\gamma_{d} S_{d}-\gamma_{m} S_{m}-\gamma_{i} S_{i}+P V_{i} \end{equation}

fully substituted

\begin{equation} \label{free-energy} F=\sigma(\pi(A_{t}^{2}-(((\frac{3 (V_{d}+(\frac{1}{6} \pi \left(\frac{S_{i} h}{\pi}\right)(3 (\sqrt{\frac{(4 \pi R_{v}^{2})}{\pi}-\left(\frac{S_{i} h}{\pi}\right)^{2}})^{2}+\left(\frac{S_{i} h}{\pi}\right)^{2})))}{\pi(2+(\frac{\gamma_{m}}{\gamma_{d}}))(1-(\frac{\gamma_{m}}{\gamma_{d}}))^{2}})^{1 / 3}) (\sqrt{1 - (\frac{\gamma_{m}}{\gamma_{d}})^{2}}))^{2})+(\pi((((\frac{3 (V_{d}+(\frac{1}{6} \pi \left(\frac{S_{i} h}{\pi}\right)(3 (\sqrt{\frac{(4 \pi R_{v}^{2})}{\pi}-\left(\frac{S_{i} h}{\pi}\right)^{2}})^{2}+\left(\frac{S_{i} h}{\pi}\right)^{2})))}{\pi(2+(\frac{\gamma_{m}}{\gamma_{d}}))(1-(\frac{\gamma_{m}}{\gamma_{d}}))^{2}})^{1 / 3}) (\sqrt{1 - (\frac{\gamma_{m}}{\gamma_{d}})^{2}}))^{2}-(\sqrt{\frac{(4 \pi R_{v}^{2})}{\pi}-\left(\frac{S_{i} h}{\pi}\right)^{2}})^{2}))+(4 \pi R_{v}^{2}))+ \frac{K}{2} (4 \pi R_{v}^{2})(\frac{2}{(\frac{(4 \pi R_{v}^{2})}{2 \pi \left(\frac{S_{i} h}{\pi}\right)})}-2C_{i})^{2}+ \gamma_{d} (2 \pi R_{d}^{2}(1-(\frac{\gamma_{m}}{\gamma_{d}})))- \gamma_{m} (\pi((((\frac{3 (V_{d}+(\frac{1}{6} \pi \left(\frac{S_{i} h}{\pi}\right)(3 (\sqrt{\frac{(4 \pi R_{v}^{2})}{\pi}-\left(\frac{S_{i} h}{\pi}\right)^{2}})^{2}+\left(\frac{S_{i} h}{\pi}\right)^{2})))}{\pi(2+(\frac{\gamma_{m}}{\gamma_{d}}))(1-(\frac{\gamma_{m}}{\gamma_{d}}))^{2}})^{1 / 3}) (\sqrt{1 - (\frac{\gamma_{m}}{\gamma_{d}})^{2}}))^{2}-(\sqrt{\frac{(4 \pi R_{v}^{2})}{\pi}-\left(\frac{S_{i} h}{\pi}\right)^{2}})^{2}))- \gamma_{i} (4 \pi R_{v}^{2})+ P (\frac{1}{6} \pi \left(\frac{S_{i} h}{\pi}\right)(3 (\sqrt{\frac{(4 \pi R_{v}^{2})}{\pi}-\left(\frac{S_{i} h}{\pi}\right)^{2}})^{2}+\left(\frac{S_{i} h}{\pi}\right)^{2})) \end{equation}

separate shape force components

\begin{equation} F(\Delta S_{o}, \Delta S_{m}, S_{d}, R_{i}, V_{i})= F_{1}(\Delta S_{o}) + F_{2}(\Delta S_{m}) + F_{3}(S_{d}) + F_{4}(R_{i}) + F_{5}(V_{i}) + C \end{equation} \begin{equation} \label{f-shapes} F= \sigma S_{o} + \left(\sigma - \gamma_{m} \right) S_{m} + \gamma_{d} S_{d} + \frac{K}{2} S_{i} \left(\frac{2}{R_{i}} - 2 C_{i}\right)^{2} + P V_{i} + D \end{equation}

full derivations

note: there may be some residual messyness since I caught a mistake in the sign of \(\gamma_{d}\) in droplet-contact-angle and corrected it after writing all these equations

  • \(F_{1}(\Delta S_{o})\)
    \begin{equation} F_{6}(S_{o}) = \sigma S_{o} \end{equation}

    substituting outside-membrane-area:

    \begin{equation} F_{6}(S_{o}) = \sigma \pi\left(A_{t}^{2}-A_{d}^{2}\right) \end{equation}

    substituting droplet-plane-radius:

    \begin{equation} F_{6}(S_{o}) = \sigma \pi\left(A_{t}^{2}-(R_{d} \sin \theta_{d})^{2}\right) \end{equation}

    substituting di-cap-radius:

    \begin{equation} F_{6}(S_{o}) = \sigma \pi\left(A_{t}^{2}-\left(\left(\frac{3 V_{b}}{\pi\left(2+\cos \theta_{d}\right)\left(1-\cos \theta_{d}\right)^{2}}\right)^{1 / 3} \sin \theta_{d}\right)^{2}\right) \end{equation}

    substituting droplet-contact-angle:

    \begin{equation} F_{6}(S_{o}) = \sigma \pi\left(A_{t}^{2}-\left(\left(\frac{3 V_{b}}{\pi\left(2+\frac{\gamma_{m}}{\gamma_{d}}\right)\left(1-\frac{\gamma_{m}}{\gamma_{d}}\right)^{2}}\right)^{1 / 3} \sqrt{1 - (\frac{\gamma_{m}}{\gamma_{d}})^{2}}\right)^{2}\right) \end{equation}

    substituting di-volume:

    \begin{equation} F_{6}(S_{o}) = \sigma \pi\left(A_{t}^{2}-\left(\left(\frac{3 (V_{d}+V_{i})}{\pi\left(2+\frac{\gamma_{m}}{\gamma_{d}}\right)\left(1-\frac{\gamma_{m}}{\gamma_{d}}\right)^{2}}\right)^{1 / 3} \sqrt{1 - (\frac{\gamma_{m}}{\gamma_{d}})^{2}}\right)^{2}\right) \end{equation}

    substituting invagination-volume:

    \begin{equation} F_{6}(S_{o}) = \sigma \pi\left(A_{t}^{2}-\left(\left(\frac{3 \left(V_{d}+\frac{\pi}{3} H_{i}^{2} \left(3 R_{i} - H_{i} \right)\right)}{\pi\left(2+\frac{\gamma_{m}}{\gamma_{d}}\right)\left(1-\frac{\gamma_{m}}{\gamma_{d}}\right)^{2}}\right)^{1 / 3} \sqrt{1 - (\frac{\gamma_{m}}{\gamma_{d}})^{2}}\right)^{2}\right) \end{equation}

    substituting invagination-radius:

    \begin{equation} F_{6}(S_{o}) = \sigma \pi\left(A_{t}^{2}-\left(\left(\frac{3 \left(V_{d}+\frac{\pi}{3} H_{i}^{2} \left(3 \frac{S_{i}}{2 \pi H_{i}} - H_{i} \right)\right)}{\pi\left(2+\frac{\gamma_{m}}{\gamma_{d}}\right)\left(1-\frac{\gamma_{m}}{\gamma_{d}}\right)^{2}}\right)^{1 / 3} \sqrt{1 - (\frac{\gamma_{m}}{\gamma_{d}})^{2}}\right)^{2}\right) \end{equation}

    "simplified" in mathematica:

    \begin{equation} F_{6}(S_{o}) = \sigma \pi \left(A_t^2+\frac{\left(\gamma _m^2-\gamma _d^2\right) \left(\frac{\gamma _d^2 \left(3 V_d+\pi H_i^2\left(\frac{3 S_i}{2 \pi H_i}-H_i\right)\right)}{\pi \left(\frac{\gamma _m}{\gamma _d}+2\right) \left(\gamma _d-\gamma _m\right)^{2}}\right)^{2/3}}{\gamma _d^2}\right) \end{equation}

    rearranged to isolate constants vs. functions of \(H_{i}\):

    endocytosis phase separation V2 - Page 5.png
    \begin{equation} F_{6}(S_{o}) = \sigma S_{o} \end{equation} \begin{equation} S_{o} = \Delta S_{o} + \pi A_{t}^{2} \end{equation} \begin{equation} F_{6}(S_{o}) = F_{1}(\Delta S_{o}) + \sigma \pi A_{t}^{2} \end{equation} \begin{equation} F_{1}(\Delta S_{o}) = \sigma \Delta S_{o} \end{equation} \begin{equation} \Delta S_{o} = S_{o} - \pi A_{t}^{2} \end{equation} \begin{equation} \Delta S_{o}=\left(\frac{\pi\left(\gamma_{m}^{2}-\gamma_{d}^{2}\right)^{3}}{\left(2 \gamma_{d}+\gamma_{m}\right)^{2}\left(\gamma_{d}-\gamma_{m}\right)^{4}}\right)^{1 / 3}\left(-\pi H_{i}^{3}+\frac{3}{2} S_{i} H_{i}+3 V_{d}\right)^{2 / 3} \end{equation}

    replacing invagination height from rel-h:

    \begin{equation} H_{i} = h \left(\frac{S_{i}}{\pi}\right)^{1/2} \end{equation} \begin{equation} \Delta S_{o}=\left(\frac{\pi\left(\gamma_{m}^{2}-\gamma_{d}^{2}\right)^{3}}{\left(2 \gamma_{d}+\gamma_{m}\right)^{2}\left(\gamma_{d}-\gamma_{m}\right)^{4}}\right)^{1 / 3}\left(-\pi \left(h \left(\frac{S_{i}}{\pi}\right)^{1/2}\right)^{3}+\frac{3}{2} S_{i} h \left(\frac{S_{i}}{\pi}\right)^{1/2}+3 V_{d}\right)^{2 / 3} \end{equation}

    simplified:

    \begin{equation} \Delta S_{o}=\left(\frac{\pi\left(\gamma_{m}^{2}-\gamma_{d}^{2}\right)^{3}}{\left(2 \gamma_{d}+\gamma_{m}\right)^{2}\left(\gamma_{d}-\gamma_{m}\right)^{4}}\right)^{1 / 3}\left(\frac{S_{i}^{3 / 2}}{\sqrt{\pi}}\left(\frac{3}{2} h-h^{3}\right)+3 V_{d}\right)^{2/3} \end{equation} \begin{equation} \Delta S_{o}=\alpha \left(\frac{S_{i}^{3 / 2}}{\sqrt{\pi}}\left(\frac{3}{2} h-h^{3}\right)+3 V_{d}\right)^{2/3} \end{equation} \begin{equation} \alpha = \left(\frac{\pi\left(\gamma_{m}^{2}-\gamma_{d}^{2}\right)^{3}}{\left(2 \gamma_{d}+\gamma_{m}\right)^{2}\left(\gamma_{d}-\gamma_{m}\right)^{4}}\right)^{1 / 3} \end{equation}
  • \(F_{2}(\Delta S_{m})\)

    gathering from free-energy:

    \begin{equation} \label{} F_{7}(S_{m}) = \left(\sigma - \gamma_{m} \right) S_{m} \end{equation}

    from md-area:

    \begin{equation} \label{md-area} S_{m}=\pi\left(A_{d}^{2}-A_{i}^{2}\right) \end{equation}

    substitute droplet-plane-radius:

    \begin{equation} A_{d}=R_{d} \sin \theta_{d} \end{equation}

    and invagination-plane-radius:

    \begin{equation} A_{i}=\sqrt{\frac{S_{i}}{\pi}-H_{i}^{2}} \end{equation}

    to get:

    \begin{equation} S_{m}=\pi\left(\left(R_{d} \sin \theta_{d}\right)^{2}-\frac{S_{i}}{\pi}+H_{i}^{2}\right) \end{equation}

    rearranged:

    \begin{equation} S_{m}=\pi\left(\left(R_{d} \sin \theta_{d}\right)^{2}+H_{i}^{2}\right) - S_{i} \end{equation}

    substitute di-cap-radius:

    \begin{equation} R_{d}=\left(\frac{3 V_{b}}{\pi\left(2+\cos \theta_{d}\right)\left(1-\cos \theta_{d}\right)^{2}}\right)^{1 / 3} \end{equation}

    to get:

    \begin{equation} S_{m}=\pi\left(\left(\left(\frac{3 V_{b}}{\pi\left(2+\cos \theta_{d}\right)\left(1-\cos \theta_{d}\right)^{2}}\right)^{1 / 3} \sin \theta_{d}\right)^{2}+H_{i}^{2}\right) - S_{i} \end{equation}

    substitute di-volume:

    \begin{equation} V_{b}=V_{d}+V_{i} \end{equation}

    to get:

    \begin{equation} S_{m}=\pi\left(\left(\left(\frac{3 \left(V_{d}+V_{i} \right)}{\pi\left(2+\cos \theta_{d}\right)\left(1-\cos \theta_{d}\right)^{2}}\right)^{1 / 3} \sin \theta_{d}\right)^{2}+H_{i}^{2}\right) - S_{i} \end{equation}

    substitute invagination-volume:

    \begin{equation} V_{i}=\frac{\pi}{3} H_{i}^{2} \left(3 R_{i} - H_{i} \right) \end{equation}

    to get:

    \begin{equation} S_{m}=\pi\left(\left(\left(\frac{3 \left(V_{d}+\frac{\pi}{3} H_{i}^{2} \left(3 R_{i} - H_{i} \right) \right)}{\pi\left(2+\cos \theta_{d}\right)\left(1-\cos \theta_{d}\right)^{2}}\right)^{1 / 3} \sin \theta_{d}\right)^{2}+H_{i}^{2}\right) - S_{i} \end{equation}

    substitute invagination-radius:

    \begin{equation} R_{i} =\frac{S_{i}}{2 \pi H_{i}} \end{equation}

    to get:

    \begin{equation} S_{m}=\pi\left(\left(\left(\frac{3 \left(V_{d}+\frac{\pi}{3} H_{i}^{2} \left(3 \frac{S_{i}}{2 \pi H_{i}} - H_{i} \right) \right)}{\pi\left(2+\cos \theta_{d}\right)\left(1-\cos \theta_{d}\right)^{2}}\right)^{1 / 3} \sin \theta_{d}\right)^{2}+H_{i}^{2}\right) - S_{i} \end{equation}

    substitute droplet-contact-angle:

    \begin{equation} \begin{array}{l} \cos \theta_{d}=\frac{\gamma_{m}}{\gamma_{d}} \\ \sin \theta_{d}=\sqrt{1 - (\frac{\gamma_{m}}{\gamma_{d}})^{2}} \end{array} \end{equation}

    to get:

    \begin{equation} S_{m}=\pi\left(\left(\left(\frac{3 \left(V_{d}+\frac{\pi}{3} H_{i}^{2} \left(3 \frac{S_{i}}{2 \pi H_{i}} - H_{i} \right) \right)}{\pi\left(2+\frac{\gamma_{m}}{\gamma_{d}}\right)\left(1-\frac{\gamma_{m}}{\gamma_{d}}\right)^{2}}\right)^{1 / 3} \sqrt{1 - (\frac{\gamma_{m}}{\gamma_{d}})^{2}}\right)^{2}+H_{i}^{2}\right) - S_{i} \end{equation}

    simplified in mathematica:

    \begin{equation} S_{m}=\pi \left(\frac{\left(\gamma _d^2-\gamma _m^2\right) \left(\frac{\gamma _d^2 \left(3 V_d+\pi H_i^2\left(\frac{3 S_i}{2 \pi H_i}-H_i\right)\right)}{\pi \left(2-\frac{\gamma _m}{\gamma _d}\right) \left(\gamma _d+\gamma _m\right)^{2}}\right)^{2/3}}{\gamma _d^2}+H_i^2\right)-S_i \end{equation}

    manually rearranged:

    endocytosis phase separation V2 - Page 6.png
    \begin{equation} \label{} F_{7}(S_{m}) = \left(\sigma - \gamma_{m} \right) S_{m} \end{equation} \begin{equation} S_{m}= \Delta S_{m} - S_{i} \end{equation} \begin{equation} \label{} F_{7}(S_{m}) = F_{2}(\Delta S_{m}) - \left(\sigma - \gamma_{m} \right) S_{i} \end{equation} \begin{equation} \label{} F_{2}(\Delta S_{m}) = \left(\sigma - \gamma_{m} \right) \Delta S_{m} \end{equation} \begin{equation} \Delta S_{m}=\left(\frac{\pi\left(\gamma_{d}^{2}-\gamma_{m}^{2}\right)^{3}}{\left(2 \gamma_{d}+\gamma_{m}\right)^{2}\left(\gamma_{d}-\gamma_{m}\right)^{4}}\right)^{1 / 3}\left(-\pi H_{i}^{3}+\frac{3}{2} S_{i} H_{i}+3 V_{d}\right)^{2 / 3}+\pi H_{i}^{2} \end{equation}

    replacing invagination height from rel-h:

    \begin{equation} H_{i} = h \left(\frac{S_{i}}{\pi}\right)^{1/2} \end{equation} \begin{equation} \Delta S_{m}=\left(\frac{\pi\left(\gamma_{d}^{2}-\gamma_{m}^{2}\right)^{3}}{\left(2 \gamma_{d}+\gamma_{m}\right)^{2}\left(\gamma_{d}-\gamma_{m}\right)^{4}}\right)^{1 / 3}\left(-\pi \left(h \left(\frac{S_{i}}{\pi}\right)^{1/2}\right)^{3}+\frac{3}{2} S_{i} \left(h \left(\frac{S_{i}}{\pi}\right)^{1/2}\right)+3 V_{d}\right)^{2 / 3}+ \pi \left(h \left(\frac{S_{i}}{\pi}\right)^{1/2}\right)^{2} \end{equation}

    simplified:

    \begin{equation} \Delta S_{m}=\left(\frac{\pi\left(\gamma_{d}^{2}-\gamma_{m}^{2}\right)^{3}}{\left(2 \gamma_{d}+\gamma_{m}\right)^{2}\left(\gamma_{d}-\gamma_{m}\right)^{4}}\right)^{1 / 3} \left(\frac{S_{i}^{3 / 2}}{\sqrt{\pi}}\left(\frac{3}{2} h-h^{3}\right)+3 V_{d}\right)^{2/3} + S_{i} h^{2} \end{equation} \begin{equation} \Delta S_{m}= \beta \left(\frac{S_{i}^{3 / 2}}{\sqrt{\pi}}\left(\frac{3}{2} h-h^{3}\right)+3 V_{d}\right)^{2/3} + S_{i} h^{2} \end{equation} \begin{equation} \beta = \left(\frac{\pi\left(\gamma_{d}^{2}-\gamma_{m}^{2}\right)^{3}}{\left(2 \gamma_{d}+\gamma_{m}\right)^{2}\left(\gamma_{d}-\gamma_{m}\right)^{4}}\right)^{1 / 3} \end{equation}
  • \(F_{3}(S_{d})\)

    gathering from free-energy:

    \begin{equation} \label{} F_{3}(S_{d}) = \gamma_{d} S_{d} \end{equation}

    from dc-contact-area:

    \begin{equation} S_{d}=2 \pi R_{d}^{2}\left(1-\cos \theta_{d}\right) \end{equation}

    substitute di-cap-radius

    \begin{equation} R_{d}=\left(\frac{3 V_{b}}{\pi\left(2+\cos \theta_{d}\right)\left(1-\cos \theta_{d}\right)^{2}}\right)^{1 / 3} \end{equation}

    to get:

    \begin{equation} S_{d}=2 \pi \left(\frac{3 V_{b}}{\pi\left(2+\cos \theta_{d}\right)\left(1-\cos \theta_{d}\right)^{2}}\right)^{2 / 3}\left(1-\cos \theta_{d}\right) \end{equation}

    substitute di-volume

    \begin{equation} V_{b}=V_{d}+V_{i} \end{equation}

    to get:

    \begin{equation} S_{d}=2 \pi \left(\frac{3 \left(V_{d}+V_{i}\right)}{\pi\left(2+\cos \theta_{d}\right)\left(1-\cos \theta_{d}\right)^{2}}\right)^{2 / 3}\left(1-\cos \theta_{d}\right) \end{equation}

    substitute invagination-volume

    \begin{equation} V_{i}=\frac{\pi}{3} H_{i}^{2} \left(3 R_{i} - H_{i} \right) \end{equation}

    to get:

    \begin{equation} S_{d}=2 \pi \left(\frac{3 \left(V_{d}+\frac{\pi}{3} H_{i}^{2} \left(3 R_{i} - H_{i} \right)\right)}{\pi\left(2+\cos \theta_{d}\right)\left(1-\cos \theta_{d}\right)^{2}}\right)^{2 / 3}\left(1-\cos \theta_{d}\right) \end{equation}

    substitute droplet-contact-angle

    \begin{equation} \cos \theta_{d}=\frac{\gamma_{m}}{\gamma_{d}} \end{equation}

    to get:

    \begin{equation} S_{d}=2 \pi \left(\frac{3 \left(V_{d}+\frac{\pi}{3} H_{i}^{2} \left(3 R_{i} - H_{i} \right)\right)}{\pi\left(2+\frac{\gamma_{m}}{\gamma_{d}}\right)\left(1-\frac{\gamma_{m}}{\gamma_{d}}\right)^{2}}\right)^{2 / 3}\left(1-\frac{\gamma_{m}}{\gamma_{d}}\right) \end{equation}

    substitute invagination-radius

    \begin{equation} R_{i} &=\frac{S_{i}}{2 \pi H_{i}} \end{equation}

    to get:

    \begin{equation} S_{d}=2 \pi \left(\frac{3 \left(V_{d}+\frac{\pi}{3} H_{i}^{2} \left(3 \frac{S_{i}}{2 \pi H_{i}} - H_{i} \right)\right)}{\pi\left(2+\frac{\gamma_{m}}{\gamma_{d}}\right)\left(1-\frac{\gamma_{m}}{\gamma_{d}}\right)^{2}}\right)^{2 / 3}\left(1-\frac{\gamma_{m}}{\gamma_{d}}\right) \end{equation}

    simplified in mathematica:

    \begin{equation} S_{d}= \frac{2 \pi \left(\gamma _d-\gamma _m\right) \left(\frac{\gamma _d^2 \left(3 V_d+\pi H_i^2\left(\frac{3 S_i}{2 \pi H_i}-H_i\right)\right)}{\pi \left(\frac{\gamma _m}{\gamma _d}+2\right) \left(\gamma _d-\gamma _m\right)^{2}}\right)^{2/3}}{\gamma _d} \end{equation}

    manually rearranged:

    20210104_sd.png
    \begin{equation} S_{d}=\left(\frac{8 \pi}{\left(2+\frac{\gamma_{m}}{\gamma_{d}}\right)^{2}\left(1-\frac{\gamma_{m}}{\gamma_{d}}\right)}\right)^{1 / 3}\left(\frac{S_{i}^{3 / 2}}{\sqrt{\pi}}\left(\frac{3}{2} h-h^{3}\right)+3 V_{d}\right)^{2/3} \end{equation} \begin{equation} S_{d}=\epsilon \left(\frac{S_{i}^{3 / 2}}{\sqrt{\pi}}\left(\frac{3}{2} h-h^{3}\right)+3 V_{d}\right)^{2/3} \end{equation} \begin{equation} \epsilon = \left(\frac{8 \pi}{\left(2+\frac{\gamma_{m}}{\gamma_{d}}\right)^{2}\left(1-\frac{\gamma_{d}}{\gamma_{m}}\right)}\right)^{1 / 3} \end{equation}
  • \(F_{4}(R_{i})\)

    gathering from f-forces:

    \begin{equation} \label{} \begin{array}{l} F_{4}(R_{i}) = \frac{K}{2} S_{i} \left(\frac{2}{R_{i}} - 2 C_{i}\right)^{2} \end{array} \end{equation}

    from invagination-radius

    \begin{equation} R_{i} &=\frac{S_{i}}{2 \pi H_{i}} \end{equation}

    replacing invagination height from rel-h:

    \begin{equation} H_{i} = h \left(\frac{S_{i}}{\pi}\right)^{1/2} \end{equation} \begin{equation} R_{i} = \frac{S_{i}}{2 \pi h \left(\frac{S_{i}}{\pi}\right)^{1/2}} \end{equation}

    simplified:

    \begin{equation} R_{i} = \frac{\sqrt{S_i}}{2 \sqrt{\pi } h} \end{equation}
    • \(F_{4}(h)\)

      substitute invagination-radius

      \begin{equation} R_{i} &=\frac{S_{i}}{2 \pi H_{i}} \end{equation}

      to get:

      \begin{equation} \label{} \begin{array}{l} F_{4}(H_{i}) = \frac{K}{2} S_{i} \left(\frac{2}{\frac{S_{i}}{2 \pi H_{i}}} - 2 C_{i}\right)^{2} \end{array} \end{equation}

      simplified:

      \begin{equation} \label{} F_{4}(H_{i}) = \frac{2 K}{S_i} \left(C_i S_i-2 \pi H_i\right)^{2} \end{equation}

      replacing invagination height from rel-h:

      \begin{equation} H_{i} = h \left(\frac{S_{i}}{\pi}\right)^{1/2} \end{equation} \begin{equation} \label{} F_{4}(h) = \frac{2 K}{S_i} \left(C_i S_i-2 \pi \left(h \left(\frac{S_{i}}{\pi}\right)^{1/2}\right)\right)^{2} \end{equation}

      simplified:

      \begin{equation} \label{} F_{4}(h) = 2 K \left(C_i \sqrt{S_i}-2 \sqrt{\pi } h\right)^2 \end{equation}
  • \(F_{5}(V_{i})\)

    gathering from f-forces:

    \begin{equation} \label{} F_{5}(V_{i}) = P V_{i} \end{equation}

    from invagination-volume-a-h:

    \begin{equation} \label{} \begin{array}{l} V_{i}=\frac{1}{6} \pi H_{i}\left(3 A_{i}^{2}+H_{i}^{2}\right) \end{array} \end{equation}

    substitute invagination-plane-radius

    \begin{equation} \label{} \begin{array}{l} A_{i}=\sqrt{\frac{S_{i}}{\pi}-H_{i}^{2}} \end{array} \end{equation}

    to get:

    \begin{equation} \label{} \begin{array}{l} V_{i}=\frac{1}{6} \pi H_{i}\left(3 \left(\frac{S_{i}}{\pi}-H_{i}^{2}\right)+H_{i}^{2}\right) \end{array} \end{equation}

    simplified:

    \begin{equation} \label{} \begin{array}{l} V_{i}=\frac{1}{6} \pi H_{i}\left(\frac{3 S_i}{\pi }-2 H_{i}^2\right) \end{array} \end{equation}

    replacing invagination height from rel-h:

    \begin{equation} H_{i} = h \left(\frac{S_{i}}{\pi}\right)^{1/2} \end{equation} \begin{equation} \label{} V_{i}=\frac{1}{6} \pi h \left(\frac{S_{i}}{\pi}\right)^{1/2}\left(\frac{3 S_i}{\pi }-2 \left(h \left(\frac{S_{i}}{\pi}\right)^{1/2}\right)^2\right) \end{equation}

    simplified:

    \begin{equation} \label{} V_{i}= \frac{h \left(3-2 h^2\right) S_i^{3/2}}{6 \sqrt{\pi }} \end{equation} \begin{equation} \label{} V_{i}=\eta \left(3 h-2 h^{3}\right) \end{equation} \begin{equation} \label{} \eta=\frac{S_i^{3/2}}{6 \sqrt{\pi }} \end{equation}
  • \(D\): everything else that doesn't change with \(H_{i}\)
    \begin{equation} \label{D} D = \sigma S_{i} - \gamma_{i} S_{i} \end{equation}
  • \(C\): additional constants grouped out from \(\Delta\) terms
    \begin{equation} \label{} C = D + \sigma \pi A_{t}^{2} - \left(\sigma - \gamma_{m} \right) S_{i} \end{equation} \begin{equation} \label{} D = \sigma S_{i} - \gamma_{i} S_{i} \end{equation}

    simplified:

    \begin{equation} \label{} C = \sigma \pi A_t^2+S_i \left(\gamma _m-\gamma _i\right) \end{equation}

DONE substituted after isolating \(h\)

  • could anything be factored out more first?
\begin{equation} \label{} F(h) = \sigma \alpha \xi + \left(\sigma - \gamma_{m} \right) \left( \beta \xi + S_{i} h^{2}\right) + \gamma_{d} \epsilon \xi + 2 K \left(C_i \sqrt{S_i}-2 \sqrt{\pi } h\right)^{2} + P \eta \left(3 h-2 h^{3}\right) + C \end{equation} \begin{equation} \label{} \xi = \left(\frac{S_{i}^{3 / 2}}{\sqrt{\pi}}\left(\frac{3}{2} h-h^{3}\right)+3 V_{d}\right)^{2/3} \end{equation}
20201203_fh (1).png
\begin{equation} F(h)=\left(\sigma \alpha+\left(\sigma-\gamma_{m}\right) \beta+\gamma_{d} \epsilon\right)\left(\frac{S_{i}^{3 / 2}}{\sqrt{\pi}}\left(\frac{3}{2} h-h^{3}\right)+3 V_{d}\right)^{2/3}+\left(\sigma-\gamma_{m}\right) S_{i} h^{2} +2 K\left(C_{i} \sqrt{S}_{i}-2 \sqrt{\pi} h\right)^{2}+P \eta \left(3 h-2 h^{3}\right)+C \end{equation} \begin{equation} F(h)= \left(\sigma \alpha+\left(\sigma-\gamma_{m}\right) \beta+\gamma_{d} \epsilon\right) \left(\frac{S_{i}^{3 / 2}}{\sqrt{\pi}}\left(\frac{3}{2} h-h^{3}\right)+3 V_{d}\right)^{2/3} - 2 P \eta h^{3}+\left(\left(\sigma-\gamma_{m}\right) S_{i}+8 K \pi\right) h^{2} +\left(3 P \eta-8 C_{i} \sqrt{\pi S_{i}}\right) h+B \end{equation} \begin{equation} B=C+2 K C_{i}^{2} S_{i} \end{equation}

testing sign of alpha terms

import numpy as np
import math
def cube_root(i):
    return math.pow(abs(i),float(1)/3) * (1,-1)[i<0]

def alpha_so(gamma_m, gamma_d):
    alpha = cube_root((np.pi*(gamma_m**2 - gamma_d**2)**3)/((2*gamma_d+gamma_m)**2 * (gamma_d-gamma_m)**4))
    return alpha

for gamma_m in np.linspace(0, 200, 9):
    for gamma_d in np.linspace(0, 200, 9):
        print('gamma_m',gamma_m,'gamma_d',gamma_d,alpha_so(gamma_m, gamma_d))
gamma_m 0.0 gamma_d 0.0 nan
gamma_m 0.0 gamma_d 25.0 -0.9226350743220142
gamma_m 0.0 gamma_d 50.0 -0.9226350743220142
gamma_m 0.0 gamma_d 75.0 -0.9226350743220142
gamma_m 0.0 gamma_d 100.0 -0.9226350743220142
gamma_m 0.0 gamma_d 125.0 -0.9226350743220142
gamma_m 0.0 gamma_d 150.0 -0.9226350743220142
gamma_m 0.0 gamma_d 175.0 -0.9226350743220142
gamma_m 0.0 gamma_d 200.0 -0.9226350743220142
gamma_m 25.0 gamma_d 0.0 1.4645918875615231
gamma_m 25.0 gamma_d 25.0 nan
gamma_m 25.0 gamma_d 50.0 -1.5026501396568157
gamma_m 25.0 gamma_d 75.0 -1.2706753068765375
gamma_m 25.0 gamma_d 100.0 -1.1735039002840684
gamma_m 25.0 gamma_d 125.0 -1.1192302015380546
gamma_m 25.0 gamma_d 150.0 -1.084415611760493
gamma_m 25.0 gamma_d 175.0 -1.0601370721917294
gamma_m 25.0 gamma_d 200.0 -1.042222647325497
gamma_m 50.0 gamma_d 0.0 1.4645918875615231
gamma_m 50.0 gamma_d 25.0 1.7436710272644398
gamma_m 50.0 gamma_d 50.0 nan
gamma_m 50.0 gamma_d 75.0 -1.830739859451904
gamma_m 50.0 gamma_d 100.0 -1.5026501396568157
gamma_m 50.0 gamma_d 125.0 -1.356188576761231
gamma_m 50.0 gamma_d 150.0 -1.2706753068765375
gamma_m 50.0 gamma_d 175.0 -1.214010595446712
gamma_m 50.0 gamma_d 200.0 -1.1735039002840684
gamma_m 75.0 gamma_d 0.0 1.4645918875615231
gamma_m 75.0 gamma_d 25.0 1.590205608287594
gamma_m 75.0 gamma_d 50.0 2.001188208394222
gamma_m 75.0 gamma_d 75.0 nan
gamma_m 75.0 gamma_d 100.0 -2.0727783992021025
gamma_m 75.0 gamma_d 125.0 -1.6820324801561286
gamma_m 75.0 gamma_d 150.0 -1.5026501396568157
gamma_m 75.0 gamma_d 175.0 -1.3955026949998752
gamma_m 75.0 gamma_d 200.0 -1.3231738439535343
gamma_m 100.0 gamma_d 0.0 1.4645918875615231
gamma_m 100.0 gamma_d 25.0 1.5377251238700236
gamma_m 100.0 gamma_d 50.0 1.7436710272644398
gamma_m 100.0 gamma_d 75.0 2.208757298511275
gamma_m 100.0 gamma_d 100.0 nan
gamma_m 100.0 gamma_d 125.0 -2.2692052337015594
gamma_m 100.0 gamma_d 150.0 -1.830739859451904
gamma_m 100.0 gamma_d 175.0 -1.6263744927117951
gamma_m 100.0 gamma_d 200.0 -1.5026501396568157
gamma_m 125.0 gamma_d 0.0 1.4645918875615231
gamma_m 125.0 gamma_d 25.0 1.512803489134373
gamma_m 125.0 gamma_d 50.0 1.6429054603976958
gamma_m 125.0 gamma_d 75.0 1.8801889207945017
gamma_m 125.0 gamma_d 100.0 2.384131644400035
gamma_m 125.0 gamma_d 125.0 nan
gamma_m 125.0 gamma_d 150.0 -2.436744690673985
gamma_m 125.0 gamma_d 175.0 -1.959079850097313
gamma_m 125.0 gamma_d 200.0 -1.7343631139416589
gamma_m 150.0 gamma_d 0.0 1.4645918875615231
gamma_m 150.0 gamma_d 25.0 1.498872430465395
gamma_m 150.0 gamma_d 50.0 1.590205608287594
gamma_m 150.0 gamma_d 75.0 1.7436710272644396
gamma_m 150.0 gamma_d 100.0 2.001188208394222
gamma_m 150.0 gamma_d 125.0 2.5372464543855386
gamma_m 150.0 gamma_d 150.0 nan
gamma_m 150.0 gamma_d 175.0 -2.5840841134673402
gamma_m 150.0 gamma_d 200.0 -2.0727783992021025
gamma_m 175.0 gamma_d 0.0 1.4645918875615234
gamma_m 175.0 gamma_d 25.0 1.4902570606397723
gamma_m 175.0 gamma_d 50.0 1.5585019217103644
gamma_m 175.0 gamma_d 75.0 1.6687875802778238
gamma_m 175.0 gamma_d 100.0 1.836572392913886
gamma_m 175.0 gamma_d 125.0 2.1098678647384412
gamma_m 175.0 gamma_d 150.0 2.6739764366927052
gamma_m 175.0 gamma_d 175.0 nan
gamma_m 175.0 gamma_d 200.0 -2.71637250521393
gamma_m 200.0 gamma_d 0.0 1.4645918875615231
gamma_m 200.0 gamma_d 25.0 1.4845441581729593
gamma_m 200.0 gamma_d 50.0 1.5377251238700236
gamma_m 200.0 gamma_d 75.0 1.6219368867750477
gamma_m 200.0 gamma_d 100.0 1.7436710272644398
gamma_m 200.0 gamma_d 125.0 1.9220789459321215
gamma_m 200.0 gamma_d 150.0 2.208757298511275
gamma_m 200.0 gamma_d 175.0 2.7980755038451366
gamma_m 200.0 gamma_d 200.0 nan
/tmp/ipykernel_172232/638675132.py:7: RuntimeWarning: invalid value encountered in double_scalars
  alpha = cube_root((np.pi*(gamma_m**2 - gamma_d**2)**3)/((2*gamma_d+gamma_m)**2 * (gamma_d-gamma_m)**4))
/tmp/ipykernel_172232/638675132.py:4: DeprecationWarning: In future, it will be an error for 'np.bool_' scalars to be interpreted as an index
  return math.pow(abs(i),float(1)/3) * (1,-1)[i<0]

implementation and analysis [36/42]

analytical derivations

thermodynamic spontaneity (global stability) [5/5]

  • I'm defining "thermodynamic spontaneity" as whether F(h=0) > F(h=1)
  • analyzed by plotting the phase boundary line across 2 parameters when F(h=0) == F(h=1)
  • DONE setting up equality
    20210104_thermodynamic_spontaneity_kfix.png
    \begin{equation} \left(\sigma \alpha+\left(\sigma-\gamma_{m}\right) \beta+\gamma_{d} \in\right)\left(3 V_{d}\right)^{2 / 3}+B=\left(\sigma \alpha+\left(\sigma-\gamma_{m}\right) \beta+\gamma_{d} \in\right)\left(3 V_d+\frac{S_i^{3/2}}{2 \sqrt{\pi }}\right)^{2/3} + \left(\sigma-\gamma_{m}\right) S_{i}+8 K \pi+ P \eta-8 K C_{i} \sqrt{\pi S_{i}}+B \end{equation}
  • DONE solving for \(K\)
    20210104_thermodynamic_k.png
    \begin{equation} \label{therm_spont_k} K = \frac{\left(\sigma \alpha+\left(\sigma-\gamma_{m}\right) \beta+\gamma_{d} \in\right)\left(\left(3 V_{d}\right)^{2 / 3}-\left(\frac{S_{i}^{3 / 2}}{2 \sqrt{\pi}}+3 V_{d}\right)^{2 / 3}\right)-\left(\sigma-\gamma_{m}\right) S_{i}- P \eta}{8 \pi-8 C_{i} \sqrt{\pi S_{i}}} \end{equation}
  • DONE solving for \(P\)
    20210104_thermodynamic_p.png
    \begin{equation} \label{therm_spont_p} P=\frac{\left(\sigma \alpha+\left(\sigma-\gamma_{m}\right) \beta+\gamma_{d} \in\right)\left(\left(3 V_{d}\right)^{2 / 3}-\left(\frac{S_{i}^{3 / 2}}{2 \sqrt{\pi}}+3 V_{d}\right)^{2 / 3}\right)-\left(\sigma-\gamma_{m}\right) S_{i}-8 K \left(\pi - C_{i} \sqrt{\pi S_{i}}\right)}{\eta} \end{equation}
  • DONE solving for \(\sigma\)
    20210104_thermodynamic_sigma.png
    \begin{equation} \label{therm_spont_sigma} \sigma=\frac{\frac{-\gamma_{m} S_{i}+8 K \left(\pi - C_{i} \sqrt{\pi S_{i}}\right) + P \eta}{\left(3 V_{d}\right)^{2 / 3}-\left(\frac{S_{i}^{3 / 2}}{2 \sqrt{\pi}}+3 V_{d}\right)^{2 / 3}}-\gamma_{d} \epsilon+\gamma_{m} \beta}{\alpha+\beta-\frac{S_{i}}{\left(3 V_{d}\right)^{2 / 3}-\left(\frac{S_{i}^{3 / 2}}{2 \sqrt{\pi}}+3 V_{d}\right)^{2 / 3}}} \end{equation}
  • DONE solving for \(C_{i}\)
    20210104_thermodynamic_ci.png
    \begin{equation} \label{therm_spont_ci} C_{i} = \frac{\pi-\frac{\left(\sigma \alpha+\left(\sigma-\gamma_{m}\right) \beta+\gamma_{d} \in\right)\left(\left(3 V_{d}\right)^{2 / 3}-\left(\frac{S_{i}^{3 / 2}}{2 \sqrt{\pi}}+3 V_{d}\right)^{2 / 3}\right)-\left(\sigma-\gamma_{m}\right) S_{i}-P_{\eta}}{8 K}}{\sqrt{\pi S_{i}}} \end{equation}
  • any others?

kinetic spontaneity (local stability) [11/11]

  • I'm defining "kinetic spontaneity" as whether F'(h=0) is negative or positive
  • DONE solving derivative
    20210105_f_derivative.png
    \begin{equation} \label{f-prime} F^{\prime}(h)=\frac{\left(\sigma \alpha+\left(\sigma-\gamma_{m}\right) \beta+\gamma_{d} \epsilon\right)\left(1-2 h^{2}\right) S_{i}^{3 / 2}}{\sqrt{\pi}\left(\frac{\left(\frac{3 h}{2}-h^{3}\right) S_{i}^{3 / 2}}{\sqrt{\pi}}+3 V_{d}\right)^{1 / 3}}-6 P \eta h^{2}+2\left(\left(\sigma-\gamma_{m}\right) S_{i}+8 K \pi\right) h+3 P \eta-8 K C_{i} \sqrt{\pi S_{i}} \end{equation}
  • DONE solving for h=0
    \begin{equation} \label{f-prime-alpha-beta} F^{\prime}(0)=\frac{\left(\sigma \alpha+\left(\sigma-\gamma_{m}\right) \beta+\gamma_{d} \epsilon\right) S_{i}^{3 / 2}}{\sqrt{\pi} \left(3 V_{d}\right)^{1 / 3}}+3 P \eta-8 K C_{i} \sqrt{\pi S_{i}} \end{equation} \begin{equation} \label{f-prime} F^{\prime}(0)=\frac{\left(\gamma_{m} \alpha + \gamma_{d} \epsilon \right) S_{i}^{3 / 2}}{\sqrt{\pi} \left(3 V_{d}\right)^{1 / 3}}+3 P \eta-8 K C_{i} \sqrt{\pi S_{i}} \end{equation}
  • DONE sign of droplet prefactor at h=0
    20210217_prefactor_sign.png

    the sign of the term concerning the droplet must always be positive.

  • DONE solving for \(K\)
    20210106_kinetic_k.png
    \begin{equation} \label{kinetic_spont_k} K=\frac{\frac{\left(\sigma \alpha+\left(\sigma-\gamma_{m}\right) \beta+\gamma_{d} \epsilon\right) S_{i}^{3 / 2}}{\sqrt{\pi}\left(3 V_{d}\right)^{1 / 3}}+3 P \eta}{8 C_{i} \sqrt{\pi S_{i}}} \end{equation}
  • DONE solving for \(P\)
    20210106_kinetic_p.png
    \begin{equation} \label{kinetic_spont_p} P=\frac{\frac{-\left(\sigma \alpha+\left(\sigma-\gamma_{m}\right) \beta+\gamma_{d} \epsilon\right) S_{i}^{3 / 2}}{\sqrt{\pi}\left(3 V_{d}\right)^{1 / 3}}+8 K C_{i} \sqrt{\pi S_{i}}}{3 \eta} \end{equation}
  • DONE solving for \(\sigma\)
    20210106_kinetic_sigma.png
    \begin{equation} \label{kinetic_spont_sigma} \sigma=\frac{\frac{\sqrt{\pi}\left(3 V_{d}\right)^{1 / 3}}{S_{i}^{3 / 2}}\left(8 K C_{i} \sqrt{\pi S_{i}}-3 P \eta \right)-\gamma_{d} \epsilon+\gamma_{m} \beta}{(\alpha+\beta)} \end{equation}
  • DONE solving for \(C_{i}\)
    20210106_derivs_kinetic_ci.png
    \begin{equation} \label{kinetic_spont_ci} C_{i} = \frac{\frac{\left(\sigma \alpha+\left(\sigma-\gamma_{m}\right) \beta+\gamma_{d} \epsilon\right) S_{i}^{3 / 2}} {\sqrt{\pi}\left(3 V_{d}\right)^{1 / 3}}+3 P \eta}{8 K \sqrt{\pi S_{i}}} \end{equation}
  • CANCELLED solving for \(\gamma_{m}\)
    20210106_derivs_kinetic_gammam.png
    \begin{equation} \label{kinetic_spont_gammam} \gamma_{m}=\frac{\frac{-\sqrt{\pi}\left(3 V_{d}\right)^{1 / 3}}{S_{i}^{3 / 2}}\left(8 K C_{i} \sqrt{\pi S_{i}}-3 P \eta \right)+\gamma_{d} \epsilon+\sigma \alpha+\sigma \beta}{\beta} \end{equation}
  • CANCELLED solving for \(\gamma_{d}\)
    20210106_derivs_kinetic_gammad.png
    \begin{equation} \label{kinetic_spont_gammad} \gamma_{d}=\frac{\frac{\sqrt{\pi}\left(3 V_{d}\right)^{1 / 3}}{S_{i}^{3 / 2}}\left(8 K C_{i} \sqrt{\pi S_{i}}-3 P \eta \right)-\sigma \alpha-\left(\sigma-\gamma_{m}\right) \beta}{\epsilon} \end{equation}
  • CANCELLED solving for \(S_{i}\)
  • DONE solving for \(V_{d}\)
    20210106_derivs_kinetic_vd.png
    \begin{equation} \label{kinetic_spont_vd} V_{d}=\frac{\left(\frac{\left(\sigma \alpha+\left(\sigma-\gamma_{m}\right) \beta+\gamma_{d} \epsilon \right) S_{i}^{3 / 2}}{\left(8 K C_{i} \sqrt{\pi S_{i}}-3 P \eta \right) \sqrt{\pi}}\right)^{3}}{3} \end{equation}

python code [20/26]

configuration [12/13]

  • import libraries, settings
    %gui qt
    import napari
    from decimal import Decimal
    import math
    import numpy as np
    import pandas as pd
    import matplotlib.pyplot as plt  # plotting
    import mpl_toolkits.mplot3d.axes3d as axes3d
    %matplotlib inline
    import seaborn as sns
    import scipy
    #sns.set(style='ticks')
    #sns.set_palette(sns.cubehelix_palette(10, start=.1, rot=-.75, reverse=True))
    sns.set_palette('hls',8)
    #sns.set_palette(sns.diverging_palette(250, 30, l=65, center="dark"))
    # sns.set_palette("coolwarm", 6)
    # from cycler import cycler
    SMALL_SIZE = 12
    MEDIUM_SIZE = 16
    BIGGER_SIZE = 20
    
    
    plt.rc('axes', titlesize=MEDIUM_SIZE)     # fontsize of the axes title
    plt.rc('axes', labelsize=MEDIUM_SIZE)    # fontsize of the x and y labels
    plt.rc('xtick', labelsize=SMALL_SIZE)    # fontsize of the tick labels
    plt.rc('ytick', labelsize=SMALL_SIZE)    # fontsize of the tick labels
    plt.rc('legend', fontsize=SMALL_SIZE)    # legend fontsize
    plt.rc('figure', titlesize=BIGGER_SIZE)  # fontsize of the figure title
    # default_cycler = (cycler(color=['indigo', 'darkgreen', 'purple', 'green', 'magenta', 'lime']))
    # plt.rc('axes', prop_cycle=default_cycler)
    
    pi = np.pi 
    
    #if kernel was started in notebook directory
    #fig_dir = 'figures/'
    #assuming kernel was started in home directory
    fig_dir = 'google_drive/grad_school/db_lab/code/analysis/llps_endocytosis_modeling/figures/'
    
    import IPython
    from tabulate import tabulate
    
    class OrgFormatter(IPython.core.formatters.BaseFormatter):
        def __call__(self, obj):
            try:
                return tabulate(obj, headers='keys',
                                tablefmt='orgtbl', showindex='always')
            except:
                return None
    
    ip = get_ipython()
    ip.display_formatter.formatters['text/org'] = OrgFormatter()
    
  • set default fixed parameter values
    • assigned here
      vesicle_radius = 50. #nm
      vesicle_diameter = 2*vesicle_radius #nm
      drop_radius = 1500. #nm
      S_i = 4.*pi*vesicle_radius**2 #nm^2
      #H_i_range = np.linspace(0.001*vesicle_radius,2*vesicle_radius,1000) #nm
      h_range = np.linspace(0.001,1,1000) #dimensionless 0-1
      H_i_range = h_range*(S_i/pi)**(1/2)
      sigma = 150. #arbitrary, N/nm^2
      A_t = 1000 #nm, arbitrary
      K = 100. #arbitrary, N/nm
      C_i = 1/vesicle_radius #nm^-1
      gamma_d = 200. #arbitrary N/nm^2
      gamma_m = 175. #arbitrary, N/nm^2
      gamma_i = gamma_m
      V_d = 4.*pi*drop_radius**2 #nm^3
      P = 1000/(10**9) #N/nm^3
      
      params = {'vesicle_radius' : vesicle_radius,
          'vesicle_diameter' : vesicle_diameter,
          'drop_radius' : drop_radius,
          'S_i' : S_i,
          'h_range' : h_range,
          'H_i_range' : H_i_range,
          'sigma' : sigma,
          'A_t' : A_t,
          'K' : K,
          'C_i' : C_i,
          'gamma_d' : gamma_d,
          'gamma_m' : gamma_m,
          'gamma_i' : gamma_i,
          'V_d' : V_d,
          'P':P}
      
    • assigned from org table

      established in variables

      variable_df = pd.DataFrame(variable_list[1:], columns=variable_list[0])
      variable_df = variable_df.set_index('python variable')
      param_values = variable_df['value']
      variable_df
      
      
      python variable description value units reference type associated equation LaTeX variable
      H_i invagination height   \(nm\)   input (variable)   \(H_{i}\)
      sigma membrane tension 0.001 \(pN/nm\) (Hassinger et al. 2017) fixed   \(\sigma\)
      A_t total plane radius 2000 \(nm\)   fixed   \(A_{t}\)
      vesicle_radius final vesicle radius 50 \(nm\) (Kaksonen and Roux 2018) fixed   \(R_{v}\)
      K coat bending rigidity 160 \(pN nm\) (Dmitrieff and Nédélec 2015) fixed   \(K\)
      C_i spontaneous curvature 1/50 \(nm^{-1}\) (Hassinger et al. 2017) fixed   \(C_{i}\)
      gamma_d droplet-cytosol surface tension 0.005 \(pN/nm\) (Jawerth et al. 2018) fixed   \(\gamma_{d}\)
      gamma_m droplet-membrane wetting tension 0.002 \(pN/nm\)   fixed   \(\gamma_{m}\)
        initial droplet plane radius       fixed    
      gamma_i droplet-invagination surface tension 0.002 \(pN/nm\)   fixed   \(\gamma_{i}\)
      P turgor pressure 0.1 \(pN/nm^2\) (NO_ITEM_DATA:ma_endocytosis_2019) fixed   \(P\)
      h relative invagination height   unitless   input (variable) rel-h \(h\)
      V_d droplet volume   \(nm^3\)   intermediate output   \(V_{d}\)
      S_i invagination surface area   \(nm^2\)   intermediate output invagination-area \(S_{i}\)
      drop_radius initial droplet spherical radius 600 \(nm\)   intermediate output    
      S_m droplet-flat membrane contact area   \(nm^2\)   intermediate output md-area \(S_{m}\)
      R_i invagination spherical radius   \(nm\)   intermediate output invagination-radius \(R_{i}\)
      S_d droplet-cytosol contact area   \(nm^2\)   intermediate output dc-contact-area \(S_{d}\)
      theta_d droplet contact angle   rad   intermediate output droplet-contact-angle \(\theta_{d}\)
      theta_i invagination contact angle   rad   intermediate output invagination-angle \(\theta_{i}\)
      A_i invagination plane radius   \(nm\)   intermediate output invagination-plane-radius \(A_{i}\)
      A_d droplet + invagination plane radius   \(nm\)   intermediate output droplet-plane-radius \(A_{d}\)
      S_o outside membrane surface area   \(nm^2\)   intermediate output outside-membrane-area \(S_{o}\)
      V_i invagination volume   \(nm^3\)   intermediate output invagination-volume \(V_{i}\)
      V_b droplet + invagination volume   \(nm^3\)   intermediate output di-volume \(V_{b}\)
      H_d droplet + invagination height   \(nm\)   intermediate output di-height \(H_{d}\)
      R_d droplet + invagination spherical radius   \(nm\)   intermediate output di-cap-radius \(R_{d}\)
      F free energy   \(pN \cdot nm\)   output f-forces f-shapes \(F\)
      membrane_tension membrane tension energy   \(pN \cdot nm\)   output    
      bending_energy bending energy   \(pN \cdot nm\)   output    
      surface_tension surface tension energy   \(pN \cdot nm\)   output    
      wetting_energy wetting energy   \(pN \cdot nm\)   output    
      turgor_pressure turgor pressure energy   \(pN \cdot nm\)   output    
      2÷R_i membrane curvature   \(nm^{-1}\)   output    
      vesicle_radius = param_values['vesicle_radius']
      vesicle_diameter = 2*vesicle_radius #nm
      drop_radius = param_values['drop_radius'] #nm
      S_i = 4.*pi*vesicle_radius**2 #nm^2
      #H_i_range = np.linspace(0.001*vesicle_radius,2*vesicle_radius,1000) #nm
      h_range = np.linspace(0.001,1,1000) #dimensionless 0-1
      H_i_range = h_range*(S_i/pi)**(1/2)
      sigma = param_values['sigma'] #arbitrary, N/nm^2
      A_t = param_values['A_t'] #nm, arbitrary
      K = param_values['K'] #arbitrary, N/nm
      C_i = 1/vesicle_radius #nm^-1
      gamma_d = param_values['gamma_d'] #arbitrary N/nm^2
      gamma_m = param_values['gamma_m'] #arbitrary, N/nm^2
      gamma_i = gamma_m
      V_d = 4.*pi*drop_radius**2 #nm^3
      P = param_values['P'] #N/nm^2
      
      params = {'vesicle_radius' : vesicle_radius,
          'vesicle_diameter' : vesicle_diameter,
          'drop_radius' : drop_radius,
          'S_i' : S_i,
          'h_range' : h_range,
          'H_i_range' : H_i_range,
          'sigma' : sigma,
          'A_t' : A_t,
          'K' : K,
          'C_i' : C_i,
          'gamma_d' : gamma_d,
          'gamma_m' : gamma_m,
          'gamma_i' : gamma_i,
          'V_d' : V_d,
          'P':P}
      
  • define composite variables

    This is just to check what they are, I re-define them whenever I solve for F

    alpha = np.cbrt((pi*(gamma_m**2-gamma_d**2)**3)/((2*gamma_d+gamma_m)**2*(gamma_d-gamma_m)**4))
    gamma_ratio = gamma_m/gamma_d
    alpha_refactored = np.cbrt((pi*(gamma_ratio+1)**3)/((gamma_ratio-1)*(gamma_ratio+2)**2))
    beta = np.cbrt((pi*(gamma_d**2-gamma_m**2)**3)/((2*gamma_d+gamma_m)**2*(gamma_d-gamma_m)**4))
    #epsilon = np.cbrt((8*pi)/((2+gamma_m/gamma_d)**2*(1-gamma_m/gamma_d)))
    epsilon = np.cbrt((8*pi)/((2+gamma_ratio)**2*(1-gamma_ratio)))
    eta = (S_i**(3/2))/(6*pi**(1/2))
    C = sigma*pi*A_t**2+S_i*(gamma_m-gamma_i)
    
    alpha, alpha_refactored, beta, epsilon, eta, C
    
    -1.3561885767612312 -1.356188576761231 1.3561885767612312 1.937412252516044 523598.7755982989 12566.370614359173
  • custom functions [12/13]
    • model functions
      • pre-analytical version
        • [ ] rewrite each function variable as dictionary key (outpus['theta_d'] instead of theta_d for the first one) and just return outputs at end
          • should eliminate some redundancy

             def llps_model(H_i=H_i_range, sigma=sigma, A_t=A_t, S_i=S_i, K=K,
                           C_i=C_i, gamma_d=gamma_d, gamma_m=gamma_m, gamma_i=gamma_i, V_d=V_d,
                           P=P):
                 #H_i = h*(S_i/pi)**(1/2)
                 # might need to be -gamma_m/gamma_d
                 theta_d = np.arccos(gamma_m/gamma_d) #equation 8
                 #to make a full array out of the constant theta_d value
                 #theta_d = np.full_like(H_i, theta_d)  
                 A_i = ((S_i/pi)-H_i**2)**(1/2) #equation 7
                 V_i = (1/6)*pi*H_i*(3*A_i**2+H_i**2) #equation 6
             # this is actually wrong!
             #    R_i = (A_i**2-H_i**2)/(2*H_i) #equation 10
                 R_i = S_i/(2*pi*H_i) #equation 10 re-do
             # this is wrong!
             #    theta_i = np.arcsin(A_i/R_i) #equation 12
                 theta_i = np.arccos(1-S_i/(2*pi*R_i**2)) #equation 12 re-do
                 V_b = V_d+V_i # equation 5
            #      R_d_list = []
            #      for V in V_b:
            #          R_d_list.append(cube_root((3*V)/(pi*(2+np.cos(theta_d))*(1-np.cos(theta_d))**2))) 
                 R_d = ((3*V_b)/(pi*(2+np.cos(theta_d))*(1-np.cos(theta_d))**2))**(1/3) #equation 4
                 # R_d = np.array(R_d_list)
                 S_d = 2*pi*R_d**2*(1-np.cos(theta_d)) #equation 11
                 A_d = R_d*np.sin(theta_d) #equation 3
                 S_m = pi*(A_d**2-A_i**2) #equation 9
                 S_o = pi*(A_t**2-A_d**2) #equation 2
                 membrane_tension = sigma*(S_o+S_m+S_i)
                 bending_energy = (K/2)*S_i*((2/R_i)-(2*C_i))**2
                 surface_tension = gamma_d*S_d
                 wetting_energy = gamma_m*S_m+gamma_i*S_i
                 droplet_energy = surface_tension - wetting_energy
                 turgor_pressure = P*V_i
                 F = membrane_tension+bending_energy+surface_tension-wetting_energy+turgor_pressure #equation 1
            
                 outputs = {'theta_d':theta_d,'A_i':A_i,'V_i':V_i, 'R_i':R_i,
                            '2÷R_i':2/R_i,'theta_i':theta_i,'V_b':V_b,'R_d':R_d,
                           'S_d':S_d,'A_d':A_d,'S_m':S_m,'S_o':S_o,
                            'F':F,'membrane_tension':membrane_tension,
                            'bending_energy':bending_energy, 'bending_energy_flipped':-bending_energy,
                            'surface_tension':surface_tension,
                            'wetting_energy':-wetting_energy, 'wetting_energy_flipped':wetting_energy,
                            'droplet_energy':droplet_energy, 'turgor_pressure':turgor_pressure}
                 return outputs
            
        plt.plot(H_i_range/100,llps_model()['F'])
        plt.xlabel('h')
        plt.ylabel('F')
        plt.tight_layout()
        plt.savefig(fig_dir+'llps_model_test.png')
        
        ---------------------------------------------------------------------------
        FileNotFoundError                         Traceback (most recent call last)
        Cell In [9], line 5
              3 plt.ylabel('F')
              4 plt.tight_layout()
        ----> 5 plt.savefig(fig_dir+'llps_model_test.png')
        
        File ~/miniconda3/envs/llps_model_analysis/lib/python3.10/site-packages/matplotlib/pyplot.py:977, in savefig(*args, **kwargs)
            974 @_copy_docstring_and_deprecators(Figure.savefig)
            975 def savefig(*args, **kwargs):
            976     fig = gcf()
        --> 977     res = fig.savefig(*args, **kwargs)
            978     fig.canvas.draw_idle()   # need this if 'transparent=True' to reset colors
            979     return res
        
        File ~/miniconda3/envs/llps_model_analysis/lib/python3.10/site-packages/matplotlib/figure.py:3058, in Figure.savefig(self, fname, transparent, **kwargs)
           3054     for ax in self.axes:
           3055         stack.enter_context(
           3056             ax.patch._cm_set(facecolor='none', edgecolor='none'))
        -> 3058 self.canvas.print_figure(fname, **kwargs)
        
        File ~/miniconda3/envs/llps_model_analysis/lib/python3.10/site-packages/matplotlib/backend_bases.py:2319, in FigureCanvasBase.print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, pad_inches, bbox_extra_artists, backend, **kwargs)
           2315 try:
           2316     # _get_renderer may change the figure dpi (as vector formats
           2317     # force the figure dpi to 72), so we need to set it again here.
           2318     with cbook._setattr_cm(self.figure, dpi=dpi):
        -> 2319         result = print_method(
           2320             filename,
           2321             facecolor=facecolor,
           2322             edgecolor=edgecolor,
           2323             orientation=orientation,
           2324             bbox_inches_restore=_bbox_inches_restore,
           2325             **kwargs)
           2326 finally:
           2327     if bbox_inches and restore_bbox:
        
        File ~/miniconda3/envs/llps_model_analysis/lib/python3.10/site-packages/matplotlib/backend_bases.py:1648, in _check_savefig_extra_args.<locals>.wrapper(*args, **kwargs)
           1640     _api.warn_deprecated(
           1641         '3.3', name=name, removal='3.6',
           1642         message='%(name)s() got unexpected keyword argument "'
           1643                 + arg + '" which is no longer supported as of '
           1644                 '%(since)s and will become an error '
           1645                 '%(removal)s')
           1646     kwargs.pop(arg)
        -> 1648 return func(*args, **kwargs)
        
        File ~/miniconda3/envs/llps_model_analysis/lib/python3.10/site-packages/matplotlib/_api/deprecation.py:415, in delete_parameter.<locals>.wrapper(*inner_args, **inner_kwargs)
            405     deprecation_addendum = (
            406         f"If any parameter follows {name!r}, they should be passed as "
            407         f"keyword, not positionally.")
            408     warn_deprecated(
            409         since,
            410         name=repr(name),
           (...)
            413                  else deprecation_addendum,
            414         **kwargs)
        --> 415 return func(*inner_args, **inner_kwargs)
        
        File ~/miniconda3/envs/llps_model_analysis/lib/python3.10/site-packages/matplotlib/backends/backend_agg.py:541, in FigureCanvasAgg.print_png(self, filename_or_obj, metadata, pil_kwargs, *args)
            494 """
            495 Write the figure to a PNG file.
            496 
           (...)
            538     *metadata*, including the default 'Software' key.
            539 """
            540 FigureCanvasAgg.draw(self)
        --> 541 mpl.image.imsave(
            542     filename_or_obj, self.buffer_rgba(), format="png", origin="upper",
            543     dpi=self.figure.dpi, metadata=metadata, pil_kwargs=pil_kwargs)
        
        File ~/miniconda3/envs/llps_model_analysis/lib/python3.10/site-packages/matplotlib/image.py:1675, in imsave(fname, arr, vmin, vmax, cmap, format, origin, dpi, metadata, pil_kwargs)
           1673 pil_kwargs.setdefault("format", format)
           1674 pil_kwargs.setdefault("dpi", (dpi, dpi))
        -> 1675 image.save(fname, **pil_kwargs)
        
        File ~/miniconda3/envs/llps_model_analysis/lib/python3.10/site-packages/PIL/Image.py:2317, in Image.save(self, fp, format, **params)
           2315         fp = builtins.open(filename, "r+b")
           2316     else:
        -> 2317         fp = builtins.open(filename, "w+b")
           2319 try:
           2320     save_handler(self, fp, filename)
        
        FileNotFoundError: [Errno 2] No such file or directory: 'google_drive/grad_school/db_lab/code/analysis/llps_endocytosis_modeling/figures/llps_model_test.png'
        
        c8fe3356fecff67fa663cdfd814c256ec1d29d36.png
      • post-analytical version
        def llps_model_recbrt(h=h_range, sigma=sigma, A_t=A_t, S_i=S_i, K=K,
                       C_i=C_i, gamma_d=gamma_d, gamma_m=gamma_m, gamma_i=gamma_i,
                       V_d=V_d, P=P):
        
            alpha = np.cbrt((pi*(gamma_m**2-gamma_d**2)**3)/((2*gamma_d+gamma_m)**2*(gamma_d-gamma_m)**4))
            beta = np.cbrt((pi*(gamma_d**2-gamma_m**2)**3)/((2*gamma_d+gamma_m)**2*(gamma_d-gamma_m)**4))
            epsilon = np.cbrt((8*pi)/((2+gamma_m/gamma_d)**2*(1-gamma_m/gamma_d)))
            eta = (S_i**(3/2))/(6*pi**(1/2))
            C = sigma*pi*A_t**2+S_i*(gamma_m-gamma_i)
        
            F = ((sigma*alpha+(sigma-gamma_m)*beta+gamma_d*epsilon)* np.cbrt(((S_i**(3/2))/(pi**(1/2)))*(3*h/2-h**3)+3*V_d)**2+ (sigma-gamma_m)*S_i*h**2+ 2*K*(C_i*S_i**(1/2)-2*pi**(1/2)*h)**2+ P*eta*(3*h-2*h**3)+ C )
        
        #    print(alpha, beta, epsilon, eta, C)
        
            return F
        
        plt.plot(h_range,llps_model_recbrt())
        plt.xlabel('h')
        plt.ylabel('F')
        plt.tight_layout()
        plt.savefig(fig_dir+'llps_model_recbrt_test.png')
        
        ---------------------------------------------------------------------------
        FileNotFoundError                         Traceback (most recent call last)
        Cell In [11], line 5
              3 plt.ylabel('F')
              4 plt.tight_layout()
        ----> 5 plt.savefig(fig_dir+'llps_model_recbrt_test.png')
        
        File ~/miniconda3/envs/llps_model_analysis/lib/python3.10/site-packages/matplotlib/pyplot.py:977, in savefig(*args, **kwargs)
            974 @_copy_docstring_and_deprecators(Figure.savefig)
            975 def savefig(*args, **kwargs):
            976     fig = gcf()
        --> 977     res = fig.savefig(*args, **kwargs)
            978     fig.canvas.draw_idle()   # need this if 'transparent=True' to reset colors
            979     return res
        
        File ~/miniconda3/envs/llps_model_analysis/lib/python3.10/site-packages/matplotlib/figure.py:3058, in Figure.savefig(self, fname, transparent, **kwargs)
           3054     for ax in self.axes:
           3055         stack.enter_context(
           3056             ax.patch._cm_set(facecolor='none', edgecolor='none'))
        -> 3058 self.canvas.print_figure(fname, **kwargs)
        
        File ~/miniconda3/envs/llps_model_analysis/lib/python3.10/site-packages/matplotlib/backend_bases.py:2319, in FigureCanvasBase.print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, pad_inches, bbox_extra_artists, backend, **kwargs)
           2315 try:
           2316     # _get_renderer may change the figure dpi (as vector formats
           2317     # force the figure dpi to 72), so we need to set it again here.
           2318     with cbook._setattr_cm(self.figure, dpi=dpi):
        -> 2319         result = print_method(
           2320             filename,
           2321             facecolor=facecolor,
           2322             edgecolor=edgecolor,
           2323             orientation=orientation,
           2324             bbox_inches_restore=_bbox_inches_restore,
           2325             **kwargs)
           2326 finally:
           2327     if bbox_inches and restore_bbox:
        
        File ~/miniconda3/envs/llps_model_analysis/lib/python3.10/site-packages/matplotlib/backend_bases.py:1648, in _check_savefig_extra_args.<locals>.wrapper(*args, **kwargs)
           1640     _api.warn_deprecated(
           1641         '3.3', name=name, removal='3.6',
           1642         message='%(name)s() got unexpected keyword argument "'
           1643                 + arg + '" which is no longer supported as of '
           1644                 '%(since)s and will become an error '
           1645                 '%(removal)s')
           1646     kwargs.pop(arg)
        -> 1648 return func(*args, **kwargs)
        
        File ~/miniconda3/envs/llps_model_analysis/lib/python3.10/site-packages/matplotlib/_api/deprecation.py:415, in delete_parameter.<locals>.wrapper(*inner_args, **inner_kwargs)
            405     deprecation_addendum = (
            406         f"If any parameter follows {name!r}, they should be passed as "
            407         f"keyword, not positionally.")
            408     warn_deprecated(
            409         since,
            410         name=repr(name),
           (...)
            413                  else deprecation_addendum,
            414         **kwargs)
        --> 415 return func(*inner_args, **inner_kwargs)
        
        File ~/miniconda3/envs/llps_model_analysis/lib/python3.10/site-packages/matplotlib/backends/backend_agg.py:541, in FigureCanvasAgg.print_png(self, filename_or_obj, metadata, pil_kwargs, *args)
            494 """
            495 Write the figure to a PNG file.
            496 
           (...)
            538     *metadata*, including the default 'Software' key.
            539 """
            540 FigureCanvasAgg.draw(self)
        --> 541 mpl.image.imsave(
            542     filename_or_obj, self.buffer_rgba(), format="png", origin="upper",
            543     dpi=self.figure.dpi, metadata=metadata, pil_kwargs=pil_kwargs)
        
        File ~/miniconda3/envs/llps_model_analysis/lib/python3.10/site-packages/matplotlib/image.py:1675, in imsave(fname, arr, vmin, vmax, cmap, format, origin, dpi, metadata, pil_kwargs)
           1673 pil_kwargs.setdefault("format", format)
           1674 pil_kwargs.setdefault("dpi", (dpi, dpi))
        -> 1675 image.save(fname, **pil_kwargs)
        
        File ~/miniconda3/envs/llps_model_analysis/lib/python3.10/site-packages/PIL/Image.py:2317, in Image.save(self, fp, format, **params)
           2315         fp = builtins.open(filename, "r+b")
           2316     else:
        -> 2317         fp = builtins.open(filename, "w+b")
           2319 try:
           2320     save_handler(self, fp, filename)
        
        FileNotFoundError: [Errno 2] No such file or directory: 'google_drive/grad_school/db_lab/code/analysis/llps_endocytosis_modeling/figures/llps_model_recbrt_test.png'
        
        c8fe3356fecff67fa663cdfd814c256ec1d29d36.png
    • general plotting function
      • figure out some way to get the right units for each thing being plotted
      def plot_simulation(x=H_i_range/vesicle_diameter, output='F',
                       H_i=H_i_range, sigma=sigma, A_t=A_t, S_i=S_i, K=K,
                       C_i=C_i, gamma_d=gamma_d, gamma_m=gamma_m, gamma_i=gamma_i, V_d=V_d, P=P,
                       label=None, variable_df=variable_df):
          outputs = llps_model(H_i=H_i_range, sigma=sigma, A_t=A_t, S_i=S_i, K=K,
                    C_i=C_i, gamma_d=gamma_d, gamma_m=gamma_m, gamma_i=gamma_i, V_d=V_d, P=P)
          y = outputs[output]
          plt.plot(x,y,label=label)
          plt.ylabel(variable_df.loc[output]['description']+' ('+variable_df.loc[output]['units']+')')
      
      • testing
        plot_simulation()
        
        07513f6365b6a9eb35be95f9bf0c21ac689164c3.png
    • normalized plots
      def plot_simulation_normalized(x=H_i_range/vesicle_diameter, output='F',
                       H_i=H_i_range, sigma=sigma, A_t=A_t, S_i=S_i, K=K,
                       C_i=C_i, gamma_d=gamma_d, gamma_m=gamma_m, gamma_i=gamma_i, V_d=V_d, P=P,
                       label=None):
          outputs = llps_model(H_i=H_i_range, sigma=sigma, A_t=A_t, S_i=S_i, K=K,
                    C_i=C_i, gamma_d=gamma_d, gamma_m=gamma_m, gamma_i=gamma_i, V_d=V_d)
          y_sub = outputs[output]-np.min(outputs[output])
          y_norm = y_sub/np.max(y_sub)
          plt.plot(x,y_norm,label=label)
          plt.ylabel(output)
          plt.xlabel('invagination distance/vesicle diameter')
      
    • delta plots
      def plot_simulation_delta(x=H_i_range/vesicle_diameter, output='F',
                       H_i=H_i_range, sigma=sigma, A_t=A_t, S_i=S_i, K=K,
                       C_i=C_i, gamma_d=gamma_d, gamma_m=gamma_m, gamma_i=gamma_i, V_d=V_d, P=P,
                       label=None, variable_df=variable_df, color=None):
          outputs = llps_model(H_i=H_i_range, sigma=sigma, A_t=A_t, S_i=S_i, K=K,
                    C_i=C_i, gamma_d=gamma_d, gamma_m=gamma_m, gamma_i=gamma_i, V_d=V_d, P=P)
          output_0 = llps_model(H_i=H_i_range[0], sigma=sigma, A_t=A_t, S_i=S_i, K=K,
                    C_i=C_i, gamma_d=gamma_d, gamma_m=gamma_m, gamma_i=gamma_i, V_d=V_d, P=P)
          y = outputs[output]-output_0[output]
          plt.plot(x,y,label=label, color=color)
          #plt.ylabel('∆ '+variable_df.loc[output]['description']+' ('+variable_df.loc[output]['units']+')')
          plt.xlabel('h: invagination distance/vesicle diameter')
      
    • show geometry for given invagination distance
      def show_geometry(H_i, sigma=sigma, A_t=A_t, S_i=S_i, K=K,
                        C_i=C_i, gamma_d=gamma_d, gamma_m=gamma_m, gamma_i=gamma_i, V_d=V_d, P=P,
                        fig_width=10, fig_height=5,
                        num_plots=1, top=20, bottom=-250, left=-500, right=500):
          outputs = llps_model(H_i=H_i, sigma=sigma, A_t=A_t, S_i=S_i, K=K,
                   C_i=C_i, gamma_d=gamma_d, gamma_m=gamma_m, gamma_i=gamma_i, V_d=V_d, P=P)
      
          A_d = outputs['A_d']
          A_i = outputs['A_i']
          theta_d = outputs['theta_d']
          theta_i = outputs['theta_i']
          R_d = outputs['R_d']
          R_i = outputs['R_i']
      
          #fig, ax = plt.subplots(1,num_plots)
          #plt.subplot(1, num_plots, 1)
      
          fig = plt.figure()
          fig.set_size_inches((fig_width,fig_height))
          ax = fig.add_subplot(1, num_plots, 1)
      
          plt.hlines([0,0],[-A_t,A_d],[-A_d,A_t], color='r', label='$S_o$')
          plt.hlines([0,0],[-A_d,A_i],[-A_i,A_d], color='g', label='$S_m$')
      
          if V_d > 0:
            points_d = np.linspace(pi/2-theta_d, theta_d+pi/2, 1000)
            x_d = R_d*np.cos(points_d)
            y_d = R_d*np.sin(points_d)
            y_d_adj = y_d-np.min(y_d)
            plt.plot(x_d,-y_d_adj, color='b', label='$S_d$')
      
          points_i = np.linspace(pi/2-theta_i, theta_i+pi/2, 1000)
          x_i = R_i*np.cos(points_i)
          y_i = R_i*np.sin(points_i)
          y_i_adj = y_i-np.min(y_i)
          plt.plot(x_i,-y_i_adj, color='purple', label='$S_i$')
      
          ax.set_ylim(top=top, bottom=bottom)
          ax.set_xlim(left=left, right=right)
          ax.set_aspect('equal')
          ax.set(xlabel = 'distance along membrane (nm)', 
                 ylabel = 'distance into cytoplasm (nm)')
          plt.legend()
          plt.tight_layout()
      
          if num_plots > 1:
            return fig
      
      • testing
        show_geometry(H_i=100)
        
        dc1240c7e73de4aaa6b4c168b30fcd0ff3844e07.png
    • 3D geometry
      • points
        %gui qt
        viewer = napari.Viewer(ndisplay=3)
        
        spherecoords = []
        for H_i in np.linspace(1,100,100):
            outputs = llps_model(H_i=H_i, sigma=sigma, A_t=A_t, S_i=S_i, K=K, C_i=C_i, gamma_d=gamma_d, gamma_m=gamma_m, gamma_i=gamma_i, V_d=V_d, P=P)
        
            A_d = outputs['A_d']
            A_i = outputs['A_i']
            theta_d = outputs['theta_d']
            theta_i = outputs['theta_i']
            R_d = outputs['R_d']
            R_i = outputs['R_i']
            theta, phi = np.linspace(0,2* np.pi, 200), np.linspace(pi-theta_d, np.pi, 200)
            THETA, PHI = np.meshgrid(theta, phi)
            R = R_d
            X = R * np.sin(PHI) * np.cos(THETA)
            Y = R * np.sin(PHI) * np.sin(THETA)
            Z = R * np.cos(PHI)
            Z = Z-np.max(Z)
            height = np.full_like(Z, H_i)
            spherecoords.append(np.array([np.ravel(height), np.ravel(Z), np.ravel(Y), np.ravel(X)]).T)
        
        spherecoords = np.concatenate(spherecoords)
        viewer.add_points(np.array(spherecoords), name='droplet', size=20, face_color='cyan',
                          edge_color = 'transparent', blending='additive', opacity=0.6)
        
        spherecoords = []
        for H_i in np.linspace(1,100,100):
            outputs = llps_model(H_i=H_i, sigma=sigma, A_t=A_t, S_i=S_i, K=K, C_i=C_i, gamma_d=gamma_d, gamma_m=gamma_m, gamma_i=gamma_i, V_d=V_d, P=P)
        
            A_d = outputs['A_d']
            A_i = outputs['A_i']
            theta_d = outputs['theta_d']
            theta_i = outputs['theta_i']
            R_d = outputs['R_d']
            R_i = outputs['R_i']
            theta, phi = np.linspace(0,2* np.pi, 200), np.linspace(pi-theta_i, np.pi, 200)
            THETA, PHI = np.meshgrid(theta, phi)
            R = R_i
            X = R * np.sin(PHI) * np.cos(THETA)
            Y = R * np.sin(PHI) * np.sin(THETA)
            Z = R * np.cos(PHI)
            Z = Z-np.max(Z)
            height = np.full_like(Z, H_i)
            spherecoords.append(np.array([np.ravel(height), np.ravel(Z), np.ravel(Y), np.ravel(X)]).T)
        
        spherecoords = np.concatenate(spherecoords)
        viewer.add_points(np.array(spherecoords), name='coat', size=20, face_color='purple',
                          edge_color = 'transparent', blending='additive', opacity=0.6)
        
        spherecoords = []
        for H_i in np.linspace(1,100,100):
            outputs = llps_model(H_i=H_i, sigma=sigma, A_t=A_t, S_i=S_i, K=K, C_i=C_i, gamma_d=gamma_d, gamma_m=gamma_m, gamma_i=gamma_i, V_d=V_d, P=P)
        
            A_d = outputs['A_d']
            A_i = outputs['A_i']
            theta_d = outputs['theta_d']
            theta_i = outputs['theta_i']
            theta_m = 0.00000001
            R_d = outputs['R_d']
            R_i = outputs['R_i']
            theta, phi = np.linspace(0,2* np.pi, 200), np.linspace(pi-theta_m, np.pi, 200)
            THETA, PHI = np.meshgrid(theta, phi)
            R = 0.1*A_t/np.sin(theta_m)
            X = R * np.sin(PHI) * np.cos(THETA)
            Y = R * np.sin(PHI) * np.sin(THETA)
            Z = R * np.cos(PHI)
            Z = Z-np.max(Z)+0
            height = np.full_like(Z, H_i)
            spherecoords.append(np.array([np.ravel(height), np.ravel(Z), np.ravel(Y), np.ravel(X)]).T)
        
        spherecoords = np.concatenate(spherecoords)
        viewer.add_points(np.array(spherecoords), name='cell wall', size=20, face_color='red',
                          edge_color = 'transparent', blending='additive', opacity=0.6)
        
        
        <Points layer 'cell wall' at 0x7f3cb42b7ca0>
        
        • I don't understand why this doesn't really work
        vertices = spherecoords
        #faces = np.array([[0, 0, 1, 2], [0, 1, 2, 3], [0, 2, 3, 4]])
        faces_list = []
        counter = 0
        for H_i in range(len(H_i_range)):
            for point in range(38):
                pointa = counter + point
                faces_list.append([pointa, pointa+1, pointa+2])
            counter += 40
        faces = np.array(faces_list)
        values = np.linspace(0, 1, len(vertices))
        surface = (vertices, faces, values)
        
        viewer.add_surface(surface, colormap='viridis')  # add the surface
        
        <Surface layer 'surface' at 0x7f9405b20130>
        
      • surface

        examples:

        vertices = np.array([[0, 0, 0, 0], [0, 10, 0, 20], [0, 20, 10, 0], [0, 0, 10, 10],
                             [1, 20, 0, 0], [1, 10, 0, 20], [1, 20, 10, 0], [1, 0, 10, 10]])
        faces = np.array([[0, 1, 2], [1, 2, 3],
                          [4,5,6],[5,6,7]])
        values = np.linspace(0.9, 1, len(vertices))
        surface = (vertices, faces, values)
        
        viewer = napari.view_surface(surface)  # add the surface
        
        facesloop = []
        
        for t in (0,1):
            vert = vertices[vertices[:,0] == t]
            facest = scipy.spatial.Delaunay(vert[:,2:]).simplices + len(vert)*t
            facesloop.append(facest)
        
        facesd = np.concatenate(facesloop)
        
        viewer = napari.view_surface((vertices, facesd, values))
        
        coords = np.array([np.ravel(height), np.ravel(Z), np.ravel(Y), np.ravel(X)]).T[:,1:]
        faces = scipy.spatial.Delaunay( coords[:,1:]).simplices
        values = np.linspace(0,1,len(coords))
        viewer = napari.view_surface((coords[:,1:], faces, values))
        
        %gui qt
        viewer = napari.Viewer(ndisplay=3)
        
        spherecoords = []
        faces = []
        for H_i in range(1,101):
            outputs = llps_model(H_i=H_i, sigma=sigma, A_t=A_t, S_i=S_i, K=K, C_i=C_i, gamma_d=gamma_d, gamma_m=gamma_m, gamma_i=gamma_i, V_d=V_d, P=P)
        
            A_d = outputs['A_d']
            A_i = outputs['A_i']
            theta_d = outputs['theta_d']
            theta_i = outputs['theta_i']
            R_d = outputs['R_d']
            R_i = outputs['R_i']
            theta, phi = np.linspace(0,2* np.pi, 50), np.linspace(pi-theta_d, np.pi, 50)
            THETA, PHI = np.meshgrid(theta, phi)
            R = R_d
            X = R * np.sin(PHI) * np.cos(THETA)
            Y = R * np.sin(PHI) * np.sin(THETA)
            Z = R * np.cos(PHI)
            Z = Z-np.max(Z)
            height = np.full_like(Z, H_i)
            vertices = np.array([np.ravel(height), np.ravel(Z), np.ravel(Y), np.ravel(X)]).T
            spherecoords.append(vertices)
        
            #face = scipy.spatial.Delaunay(vertices[:,2:]).simplices + len(vertices)*(H_i-1)
            if H_i == 1:
                face = scipy.spatial.Delaunay(vertices[:,2:]).simplices + len(vertices)*(H_i-1)
            else:
                face = faces[-1] + len(vertices)
            faces.append(face)
        
        spherecoords = np.concatenate(spherecoords)
        faces = np.concatenate(faces)
        surface_values = np.full(len(spherecoords),1)
        viewer.add_surface((spherecoords,faces,surface_values), name='droplet', colormap='green',
                           blending='translucent', shading='smooth')
        
        spherecoords = []
        faces = []
        for H_i in range(1,101):
            outputs = llps_model(H_i=H_i, sigma=sigma, A_t=A_t, S_i=S_i, K=K, C_i=C_i, gamma_d=gamma_d, gamma_m=gamma_m, gamma_i=gamma_i, V_d=V_d, P=P)
        
            A_d = outputs['A_d']
            A_i = outputs['A_i']
            theta_d = outputs['theta_d']
            theta_i = outputs['theta_i']
            R_d = outputs['R_d']
            R_i = outputs['R_i']
            theta, phi = np.linspace(0,2* np.pi, 50), np.linspace(pi-theta_i, np.pi, 50)
            THETA, PHI = np.meshgrid(theta, phi)
            R = R_i
            X = R * np.sin(PHI) * np.cos(THETA)
            Y = R * np.sin(PHI) * np.sin(THETA)
            Z = R * np.cos(PHI)
            Z = Z-np.max(Z)
            height = np.full_like(Z, H_i)
            vertices = np.array([np.ravel(height), np.ravel(Z), np.ravel(Y), np.ravel(X)]).T
            spherecoords.append(vertices)
        
            if H_i == 1:
                face = scipy.spatial.Delaunay(vertices[:,2:]).simplices + len(vertices)*(H_i-1)
            else:
                face = faces[-1] + len(vertices)
            faces.append(face)
        
        spherecoords = np.concatenate(spherecoords)
        faces = np.concatenate(faces)
        surface_values = np.full(len(spherecoords),1)
        viewer.add_surface((spherecoords,faces,surface_values), name='coat', colormap='bop blue',
                           blending='additive', shading='smooth')
        
        spherecoords = []
        faces = []
        for H_i in range(1,101):
            outputs = llps_model(H_i=H_i, sigma=sigma, A_t=A_t, S_i=S_i, K=K, C_i=C_i, gamma_d=gamma_d, gamma_m=gamma_m, gamma_i=gamma_i, V_d=V_d, P=P)
        
            A_d = outputs['A_d']
            A_i = outputs['A_i']
            theta_d = outputs['theta_d']
            theta_i = outputs['theta_i']
            theta_m = 0.00000001
            R_d = outputs['R_d']
            R_i = outputs['R_i']
            theta, phi = np.linspace(0,2* np.pi, 50), np.linspace(pi-theta_m, np.pi, 50)
            THETA, PHI = np.meshgrid(theta, phi)
            R = 0.1*A_t/np.sin(theta_m)
            X = R * np.sin(PHI) * np.cos(THETA)
            Y = R * np.sin(PHI) * np.sin(THETA)
            Z = R * np.cos(PHI)
            Z = Z-np.max(Z)+0
            height = np.full_like(Z, H_i)
            vertices = np.array([np.ravel(height), np.ravel(Z), np.ravel(Y), np.ravel(X)]).T
            spherecoords.append(vertices)
        
            #face = scipy.spatial.Delaunay(vertices[:,2:]).simplices + len(vertices)*(H_i-1)
            if H_i == 1:
                face = scipy.spatial.Delaunay(vertices[:,2:]).simplices + len(vertices)*(H_i-1)
            else:
                face = faces[-1] + len(vertices)
            faces.append(face)
        
        spherecoords = np.concatenate(spherecoords)
        faces = np.concatenate(faces)
        surface_values = np.full(len(spherecoords),1)
        viewer.add_surface((spherecoords,faces,surface_values), name='cell wall', colormap='bop blue',
                           blending='opaque', shading='smooth')
        
        def update_frame():
            """Update frame or time"""
            viewer.text_overlay.text = 'h = %1.2f\nblue: membrane\ngreen: condensate' % ((viewer.dims.current_step[0]+1)/100)
        
        viewer.dims.events.current_step.connect(lambda event: update_frame())
        
        viewer.text_overlay.visible=True
        viewer.text_overlay.font_size=20
        viewer.text_overlay.color = 'white'
        viewer.scale_bar.unit = 'nm'
        viewer.scale_bar.visible=True
        viewer.scale_bar.font_size=10
        

        animation script

        from napari_animation import Animation
        
        animation = Animation(viewer)
        viewer.reset_view()
        viewer.dims.current_step = (0, 0,0,0)
        animation.capture_keyframe(steps=15)
        animation.capture_keyframe(steps=15)
        viewer.camera.zoom = 2.6
        viewer.camera.angles=(-0.026467524771271397, 0.5719902891444765, 11.550928988495166)
        animation.capture_keyframe(steps=50)
        viewer.dims.current_step = (viewer.dims.range[0][1]-1, 0,0,0)
        animation.capture_keyframe(steps=int(viewer.dims.range[0][1]-1))
        viewer.reset_view()
        animation.capture_keyframe(steps=50)
        viewer.dims.current_step = (0, 0,0,0)
        animation.capture_keyframe(steps=int(viewer.dims.range[0][1]-1))
        animation.animate('~/google_drive/grad_school/db_lab/code/analysis/llps_endocytosis_modeling/scripted_surface_animation.mov')
        
        IMAGEIO FFMPEG_WRITER WARNING: input image is not divisible by macro_block_size=16, resizing from (2300, 1454) to (2304, 1456) to ensure video compatibility with most codecs and players. To prevent resizing, make your input image divisible by the macro_block_size or set the macro_block_size to 1 (risking incompatibility).
        Rendering frame  1 of 316
        Rendering frame  2 of 316
        Rendering frame  3 of 316
        Rendering frame  4 of 316
        Rendering frame  5 of 316
        Rendering frame  6 of 316
        Rendering frame  7 of 316
        Rendering frame  8 of 316
        Rendering frame  9 of 316
        Rendering frame  10 of 316
        Rendering frame  11 of 316
        Rendering frame  12 of 316
        Rendering frame  13 of 316
        Rendering frame  14 of 316
        Rendering frame  15 of 316
        Rendering frame  16 of 316
        Rendering frame  17 of 316
        Rendering frame  18 of 316
        Rendering frame  19 of 316
        Rendering frame  20 of 316
        Rendering frame  21 of 316
        Rendering frame  22 of 316
        Rendering frame  23 of 316
        Rendering frame  24 of 316
        Rendering frame  25 of 316
        Rendering frame  26 of 316
        Rendering frame  27 of 316
        Rendering frame  28 of 316
        Rendering frame  29 of 316
        Rendering frame  30 of 316
        Rendering frame  31 of 316
        Rendering frame  32 of 316
        Rendering frame  33 of 316
        Rendering frame  34 of 316
        Rendering frame  35 of 316
        Rendering frame  36 of 316
        Rendering frame  37 of 316
        Rendering frame  38 of 316
        Rendering frame  39 of 316
        Rendering frame  40 of 316
        Rendering frame  41 of 316
        Rendering frame  42 of 316
        Rendering frame  43 of 316
        Rendering frame  44 of 316
        Rendering frame  45 of 316
        Rendering frame  46 of 316
        Rendering frame  47 of 316
        Rendering frame  48 of 316
        Rendering frame  49 of 316
        Rendering frame  50 of 316
        Rendering frame  51 of 316
        Rendering frame  52 of 316
        Rendering frame  53 of 316
        Rendering frame  54 of 316
        Rendering frame  55 of 316
        Rendering frame  56 of 316
        Rendering frame  57 of 316
        Rendering frame  58 of 316
        Rendering frame  59 of 316
        Rendering frame  60 of 316
        Rendering frame  61 of 316
        Rendering frame  62 of 316
        Rendering frame  63 of 316
        Rendering frame  64 of 316
        Rendering frame  65 of 316
        Rendering frame  66 of 316
        Rendering frame  67 of 316
        Rendering frame  68 of 316
        Rendering frame  69 of 316
        Rendering frame  70 of 316
        Rendering frame  71 of 316
        Rendering frame  72 of 316
        Rendering frame  73 of 316
        Rendering frame  74 of 316
        Rendering frame  75 of 316
        Rendering frame  76 of 316
        Rendering frame  77 of 316
        Rendering frame  78 of 316
        Rendering frame  79 of 316
        Rendering frame  80 of 316
        Rendering frame  81 of 316
        Rendering frame  82 of 316
        Rendering frame  83 of 316
        Rendering frame  84 of 316
        Rendering frame  85 of 316
        Rendering frame  86 of 316
        Rendering frame  87 of 316
        Rendering frame  88 of 316
        Rendering frame  89 of 316
        Rendering frame  90 of 316
        Rendering frame  91 of 316
        Rendering frame  92 of 316
        Rendering frame  93 of 316
        Rendering frame  94 of 316
        Rendering frame  95 of 316
        Rendering frame  96 of 316
        Rendering frame  97 of 316
        Rendering frame  98 of 316
        Rendering frame  99 of 316
        Rendering frame  100 of 316
        Rendering frame  101 of 316
        Rendering frame  102 of 316
        Rendering frame  103 of 316
        Rendering frame  104 of 316
        Rendering frame  105 of 316
        Rendering frame  106 of 316
        Rendering frame  107 of 316
        Rendering frame  108 of 316
        Rendering frame  109 of 316
        Rendering frame  110 of 316
        Rendering frame  111 of 316
        Rendering frame  112 of 316
        Rendering frame  113 of 316
        Rendering frame  114 of 316
        Rendering frame  115 of 316
        Rendering frame  116 of 316
        Rendering frame  117 of 316
        Rendering frame  118 of 316
        Rendering frame  119 of 316
        Rendering frame  120 of 316
        Rendering frame  121 of 316
        Rendering frame  122 of 316
        Rendering frame  123 of 316
        Rendering frame  124 of 316
        Rendering frame  125 of 316
        Rendering frame  126 of 316
        Rendering frame  127 of 316
        Rendering frame  128 of 316
        Rendering frame  129 of 316
        Rendering frame  130 of 316
        Rendering frame  131 of 316
        Rendering frame  132 of 316
        Rendering frame  133 of 316
        Rendering frame  134 of 316
        Rendering frame  135 of 316
        Rendering frame  136 of 316
        Rendering frame  137 of 316
        Rendering frame  138 of 316
        Rendering frame  139 of 316
        Rendering frame  140 of 316
        Rendering frame  141 of 316
        Rendering frame  142 of 316
        Rendering frame  143 of 316
        Rendering frame  144 of 316
        Rendering frame  145 of 316
        Rendering frame  146 of 316
        Rendering frame  147 of 316
        Rendering frame  148 of 316
        Rendering frame  149 of 316
        Rendering frame  150 of 316
        Rendering frame  151 of 316
        Rendering frame  152 of 316
        Rendering frame  153 of 316
        Rendering frame  154 of 316
        Rendering frame  155 of 316
        Rendering frame  156 of 316
        Rendering frame  157 of 316
        Rendering frame  158 of 316
        Rendering frame  159 of 316
        Rendering frame  160 of 316
        Rendering frame  161 of 316
        Rendering frame  162 of 316
        Rendering frame  163 of 316
        Rendering frame  164 of 316
        Rendering frame  165 of 316
        Rendering frame  166 of 316
        Rendering frame  167 of 316
        Rendering frame  168 of 316
        Rendering frame  169 of 316
        Rendering frame  170 of 316
        Rendering frame  171 of 316
        Rendering frame  172 of 316
        Rendering frame  173 of 316
        Rendering frame  174 of 316
        Rendering frame  175 of 316
        Rendering frame  176 of 316
        Rendering frame  177 of 316
        Rendering frame  178 of 316
        Rendering frame  179 of 316
        Rendering frame  180 of 316
        Rendering frame  181 of 316
        Rendering frame  182 of 316
        Rendering frame  183 of 316
        Rendering frame  184 of 316
        Rendering frame  185 of 316
        Rendering frame  186 of 316
        Rendering frame  187 of 316
        Rendering frame  188 of 316
        Rendering frame  189 of 316
        Rendering frame  190 of 316
        Rendering frame  191 of 316
        Rendering frame  192 of 316
        Rendering frame  193 of 316
        Rendering frame  194 of 316
        Rendering frame  195 of 316
        Rendering frame  196 of 316
        Rendering frame  197 of 316
        Rendering frame  198 of 316
        Rendering frame  199 of 316
        Rendering frame  200 of 316
        Rendering frame  201 of 316
        Rendering frame  202 of 316
        Rendering frame  203 of 316
        Rendering frame  204 of 316
        Rendering frame  205 of 316
        Rendering frame  206 of 316
        Rendering frame  207 of 316
        Rendering frame  208 of 316
        Rendering frame  209 of 316
        Rendering frame  210 of 316
        Rendering frame  211 of 316
        Rendering frame  212 of 316
        Rendering frame  213 of 316
        Rendering frame  214 of 316
        Rendering frame  215 of 316
        Rendering frame  216 of 316
        Rendering frame  217 of 316
        Rendering frame  218 of 316
        Rendering frame  219 of 316
        Rendering frame  220 of 316
        Rendering frame  221 of 316
        Rendering frame  222 of 316
        Rendering frame  223 of 316
        Rendering frame  224 of 316
        Rendering frame  225 of 316
        Rendering frame  226 of 316
        Rendering frame  227 of 316
        Rendering frame  228 of 316
        Rendering frame  229 of 316
        Rendering frame  230 of 316
        Rendering frame  231 of 316
        Rendering frame  232 of 316
        Rendering frame  233 of 316
        Rendering frame  234 of 316
        Rendering frame  235 of 316
        Rendering frame  236 of 316
        Rendering frame  237 of 316
        Rendering frame  238 of 316
        Rendering frame  239 of 316
        Rendering frame  240 of 316
        Rendering frame  241 of 316
        Rendering frame  242 of 316
        Rendering frame  243 of 316
        Rendering frame  244 of 316
        Rendering frame  245 of 316
        Rendering frame  246 of 316
        Rendering frame  247 of 316
        Rendering frame  248 of 316
        Rendering frame  249 of 316
        Rendering frame  250 of 316
        Rendering frame  251 of 316
        Rendering frame  252 of 316
        Rendering frame  253 of 316
        Rendering frame  254 of 316
        Rendering frame  255 of 316
        Rendering frame  256 of 316
        Rendering frame  257 of 316
        Rendering frame  258 of 316
        Rendering frame  259 of 316
        Rendering frame  260 of 316
        Rendering frame  261 of 316
        Rendering frame  262 of 316
        Rendering frame  263 of 316
        Rendering frame  264 of 316
        Rendering frame  265 of 316
        Rendering frame  266 of 316
        Rendering frame  267 of 316
        Rendering frame  268 of 316
        Rendering frame  269 of 316
        Rendering frame  270 of 316
        Rendering frame  271 of 316
        Rendering frame  272 of 316
        Rendering frame  273 of 316
        Rendering frame  274 of 316
        Rendering frame  275 of 316
        Rendering frame  276 of 316
        Rendering frame  277 of 316
        Rendering frame  278 of 316
        Rendering frame  279 of 316
        Rendering frame  280 of 316
        Rendering frame  281 of 316
        Rendering frame  282 of 316
        Rendering frame  283 of 316
        Rendering frame  284 of 316
        Rendering frame  285 of 316
        Rendering frame  286 of 316
        Rendering frame  287 of 316
        Rendering frame  288 of 316
        Rendering frame  289 of 316
        Rendering frame  290 of 316
        Rendering frame  291 of 316
        Rendering frame  292 of 316
        Rendering frame  293 of 316
        Rendering frame  294 of 316
        Rendering frame  295 of 316
        Rendering frame  296 of 316
        Rendering frame  297 of 316
        Rendering frame  298 of 316
        Rendering frame  299 of 316
        Rendering frame  300 of 316
        Rendering frame  301 of 316
        Rendering frame  302 of 316
        Rendering frame  303 of 316
        Rendering frame  304 of 316
        Rendering frame  305 of 316
        Rendering frame  306 of 316
        Rendering frame  307 of 316
        Rendering frame  308 of 316
        Rendering frame  309 of 316
        Rendering frame  310 of 316
        Rendering frame  311 of 316
        Rendering frame  312 of 316
        Rendering frame  313 of 316
        Rendering frame  314 of 316
        Rendering frame  315 of 316
        Rendering frame  316 of 316
        
      • probably don't need this stuff
        num_plots = 1
        outputs = llps_model(H_i=90, sigma=sigma, A_t=A_t, S_i=S_i, K=K, C_i=C_i, gamma_d=gamma_d, gamma_m=gamma_m, gamma_i=gamma_i, V_d=V_d, P=P)
        
        A_d = outputs['A_d']
        A_i = outputs['A_i']
        theta_d = outputs['theta_d']
        theta_i = outputs['theta_i']
        R_d = outputs['R_d']
        R_i = outputs['R_i']
        
        #fig, ax = plt.subplots(1,num_plots)
        #plt.subplot(1, num_plots, 1)
        
        #fig = plt.figure()
        #fig.set_size_inches((fig_width,fig_height))
        #ax = fig.add_subplot(1, num_plots, 1)
        
        #plt.hlines([0,0],[-A_t,A_d],[-A_d,A_t], color='r', label='$S_o$')
        #plt.hlines([0,0],[-A_d,A_i],[-A_i,A_d], color='g', label='$S_m$')
        
        if V_d > 0:
            points_d = np.linspace(pi/2-theta_d, theta_d+pi/2, 1000)
            x_d = R_d*np.cos(points_d)
            y_d = R_d*np.sin(points_d)
            y_d_adj = y_d-np.min(y_d)
        
        points_i = np.linspace(pi/2-theta_i, theta_i+pi/2, 1000)
        x_i = R_i*np.cos(points_i)
        y_i = R_i*np.sin(points_i)
        y_i_adj = y_i-np.min(y_i)
        
        xy_i = np.array([y_i,x_i]).T
        viewer = napari.Viewer()
        viewer.add_points(xy_i)
        
        <Points layer 'xy_i' at 0x7f9405887370>
        
        nx, ny, nz = (3, 3, 4)
        x = np.linspace(0, 10, nx)
        y = np.linspace(0, 10, ny)
        z = np.linspace(0, 10, nz)
        
        xv, yv, zv = np.meshgrid(x, y, z)
        zyxv = np.array([np.ravel(zv), np.ravel(yv), np.ravel(xv)]).T
        zyxv
        
        viewer = napari.Viewer()
        viewer.add_points(zyxv)
        
        <Points layer 'zyxv' at 0x7f93f2b41fd0>
        
        import numpy as np
        import matplotlib.pyplot as plt
        from mpl_toolkits import mplot3d
        
        ax = plt.axes(projection="3d")
        xlist=np.linspace(-1.0,1.0,10)*100
        ylist=np.linspace(-1.0,1.0,10)*100
        r=np.linspace(1.0,1.0,10)*100
        X,Y= np.meshgrid(xlist,ylist)
        
        Z=np.sqrt(r**2-X**2-Y**2) #Use np.sqrt like you had before
        
        spherecoords = np.array([np.ravel(Z), np.ravel(Y), np.ravel(X)]).T
        viewer.add_points(spherecoords)
        
        vertices = spherecoords
        faces = np.array([[0, 50, 99], [1, 2, 3]])
        values = np.linspace(1, 1, len(vertices))
        surface = (vertices, faces, values)
        
        viewer.add_surface(surface)
        
        cp=ax.plot_wireframe(X,Y,Z,color="r")
        cp=ax.plot_wireframe(X,Y,-Z,color="r") # Now plot the bottom half
        
        
        plt.title('2D Contour Plot of The unit sphere')
        plt.show()
        
        <ipython-input-21-c34f0052e1a6>:11: RuntimeWarning: invalid value encountered in sqrt
          Z=np.sqrt(r**2-X**2-Y**2) #Use np.sqrt like you had before
        
        e0cc5e561ea03e27b011a913d05aff6ff077c5fd.png
    • side-by-side delta plot and equilibrium geometry
      def plot_simulation_geometry(x=H_i_range/vesicle_diameter, output='F',
                       H_i=H_i_range, sigma=sigma, A_t=A_t, S_i=S_i, K=K,
                       C_i=C_i, gamma_d=gamma_d, gamma_m=gamma_m, gamma_i=gamma_i, V_d=V_d, P=P,
                       fig_width=15, fig_height=5, label=None, variable_df=variable_df,
                      num_plots=2, top=20, bottom=-250, left=-500, right=500):
          outputs = llps_model(H_i=H_i_range, sigma=sigma, A_t=A_t, S_i=S_i, K=K,
                    C_i=C_i, gamma_d=gamma_d, gamma_m=gamma_m, gamma_i=gamma_i, V_d=V_d)
          min_energy_ix = np.argmin(outputs['F'])
          H_i_eq = H_i_range[min_energy_ix]
          fig = show_geometry(H_i=H_i_eq, sigma=sigma, A_t=A_t, S_i=S_i, K=K,
                         C_i=C_i, gamma_d=gamma_d, gamma_m=gamma_m, gamma_i=gamma_i, V_d=V_d, P=P,
                         fig_width=fig_width, fig_height=fig_height,
                         num_plots=num_plots, top=top, bottom=bottom, left=left, right=right)
          plt.title('geometry at equilibrium')
          ax2 = fig.add_subplot(1,2,2)
          #y = outputs[output]
          #plt.plot(x,y,label=label)
          #plt.ylabel(output)
      
          plot_simulation_delta(x=x, output=output,
                       H_i=H_i_range, sigma=sigma, A_t=A_t, S_i=S_i, K=K,
                       C_i=C_i, gamma_d=gamma_d, gamma_m=gamma_m, gamma_i=gamma_i, V_d=V_d, P=P,
                       label=label, variable_df=variable_df)
      
          plt.tight_layout()
      
      • testing
        plot_simulation_geometry()
        
        919d3104ddd84a014e93996a89df4a09f5207fd8.png
    • side-by-side F plots and parameter phase diagram
      def boundary_test(x_param, y_param, x_range, boundary, params=params,
                        factors=[0.7,1,1.3], y_offset=0.2, x_scale='log'):
          fparams = params.copy()
          fig, (ax1, ax2)  = plt.subplots(nrows=1, ncols=2, figsize=(10,4))
      
          if x_scale == 'log':
              ax1.semilogx(x_range, boundary, color='black')
          else:
              ax1.plot(x_range, boundary, color='black')
      
          for factor in factors:
              middle = len(x_range)//2
              x_pick = x_range[middle]*factor
              boundary_pick = boundary[middle]+(factor-1)*np.sqrt(boundary[middle]**2)*y_offset
              fparams[x_param] = x_pick
              fparams[y_param] = boundary_pick
              F = llps_model_recbrt(h=fparams['h_range'], sigma=fparams['sigma'], A_t=fparams['A_t'],
                      S_i=fparams['S_i'], K=fparams['K'], C_i=fparams['C_i'], gamma_d=fparams['gamma_d'],
                      gamma_m=fparams['gamma_m'], gamma_i=fparams['gamma_i'], V_d=fparams['V_d'], P=fparams['P'])
              delta_F = F-F[0]
      
              ax1.scatter(x_pick, boundary_pick)
              ax2.plot(h_range,delta_F)
      
          ax2.hlines(0, 0,1.05, color='black')
      
          ax1.set(xlabel=x_param, ylabel=y_param)
          ax2.set(xlabel='h', ylabel='∆F')
          plt.tight_layout()
      
    • global stability parameter analysis [4/4]
      • DONE \(K\)

        from therm_spont_k

        def thermo_spont_K(sigma=sigma, gamma_m=gamma_m, gamma_d=gamma_d,
                          V_d=V_d, S_i=S_i, P=P, C_i=C_i):
        
            alpha = np.cbrt((pi*(gamma_m**2-gamma_d**2)**3)/((2*gamma_d+gamma_m)**2*(gamma_d-gamma_m)**4))
            beta = np.cbrt((pi*(gamma_d**2-gamma_m**2)**3)/((2*gamma_d+gamma_m)**2*(gamma_d-gamma_m)**4))
            epsilon = np.cbrt((8*pi)/((2+gamma_m/gamma_d)**2*(1-gamma_m/gamma_d)))
            eta = (S_i**(3/2))/(6*pi**(1/2))
        
            K = ((-(sigma*alpha+(sigma-gamma_m)*beta+gamma_d*epsilon)*
                  (np.cbrt(3*V_d+(S_i**(3/2))/(2*pi**(1/2)))**2-
                    np.cbrt(3*V_d)**2)+2*P*eta-(sigma-gamma_m)*S_i-
                  3*P*eta)/(8*pi-8*C_i*(pi*S_i)**(1/2)))
        
            return K
        
        • testing
          V_d_range = np.logspace(6,9)
          K_boundary = thermo_spont_K(V_d=V_d_range)
          boundary_test(x_param='V_d', y_param='K', x_range=V_d_range, boundary=K_boundary)
          
          665a7d83f843680a7819f32b40f31c9caf4b42f7.png
          C_i_range = np.logspace(-4,-2.1,1000)
          K_boundary = thermo_spont_K(C_i=C_i_range)
          boundary_test(x_param='C_i', y_param='K', x_range=C_i_range, boundary=K_boundary,
                        y_offset=-0.3)
          
          d139b6fe1b14eea2f8fcc8c11e535077007730a2.png
          • this kind of makes sense - the lower the spontaneous curvature (flatter), the more the energetics are sensitive to rigidity
          x_range = np.logspace(6,9)
          thermo_boundary = thermo_spont_K(V_d=x_range)
          kinetic_boundary = kinetic_spont_K(V_d=x_range)
          both_boundary_test(x_param='V_d', y_param='K', x_range=x_range,
                             thermo_boundary=thermo_boundary, kinetic_boundary=kinetic_boundary,
                             y_offset=2)
          
          e814f99585c220b4dde760e2b4698507a17f12a6.png
      • DONE \(P\)
        def thermo_spont_P(sigma=sigma, gamma_m=gamma_m, gamma_d=gamma_d,
                          V_d=V_d, S_i=S_i, K=K, C_i=C_i):
        
            alpha = np.cbrt((pi*(gamma_m**2-gamma_d**2)**3)/((2*gamma_d+gamma_m)**2*(gamma_d-gamma_m)**4))
            beta = np.cbrt((pi*(gamma_d**2-gamma_m**2)**3)/((2*gamma_d+gamma_m)**2*(gamma_d-gamma_m)**4))
            epsilon = np.cbrt((8*pi)/((2+gamma_m/gamma_d)**2*(1-gamma_m/gamma_d)))
            eta = (S_i**(3/2))/(6*pi**(1/2))
        
            P = ((sigma*alpha + (sigma - gamma_m)*beta + gamma_d*epsilon)*(np.cbrt(3*V_d)**2 -
                 np.cbrt(S_i**(3/2)/(2*np.sqrt(pi)) + 3*V_d)**2) -
                 (sigma-gamma_m)*S_i - 8*K*(pi - C_i*np.sqrt(pi*S_i)))/ eta
        
            return P
        
        • testing
          x_range = np.logspace(6,9)
          boundary = thermo_spont_P(V_d=x_range)
          boundary_test(x_param='V_d', y_param='P', x_range=x_range, boundary=boundary,
                        y_offset=-0.3)
          
          dbefcf0df68c98f4f818056fbe6d31aefd1d9a1b.png
      • DONE \(\sigma\)
        def thermo_spont_sigma(P=P, gamma_m=gamma_m, gamma_d=gamma_d,
                          V_d=V_d, S_i=S_i, K=K, C_i=C_i):
        
            alpha = np.cbrt((pi*(gamma_m**2-gamma_d**2)**3)/((2*gamma_d+gamma_m)**2*(gamma_d-gamma_m)**4))
            beta = np.cbrt((pi*(gamma_d**2-gamma_m**2)**3)/((2*gamma_d+gamma_m)**2*(gamma_d-gamma_m)**4))
            epsilon = np.cbrt((8*pi)/((2+gamma_m/gamma_d)**2*(1-gamma_m/gamma_d)))
            eta = (S_i**(3/2))/(6*pi**(1/2))
        
            sigma = ((-gamma_m*S_i+8*K*(pi-C_i*np.sqrt(pi*S_i))+P*eta)/
                    ((3*V_d)**(2/3)-((S_i**(3/2))/
                        (2*np.sqrt(pi))+3*V_d)**(2/3))-
                     gamma_d*epsilon+gamma_m*beta)/(alpha+beta-
                    (S_i)/((3*V_d)**(2/3)-((S_i**(3/2))/
                            (2*np.sqrt(pi))+3*V_d)**(2/3)))
        
            return sigma
        
        • testing
          x_range = np.logspace(6,9)
          boundary = thermo_spont_sigma(V_d=x_range)
          boundary_test(x_param='V_d', y_param='sigma', x_range=x_range, boundary=boundary,
                        y_offset=-0.02)
          
          56de5a9bde3d9715633bcb7f298c02800d3679b8.png
      • DONE \(C_{i}\)
        def thermo_spont_C_i(P=P, gamma_m=gamma_m, gamma_d=gamma_d,
                          V_d=V_d, S_i=S_i, K=K, sigma=sigma):
        
            alpha = np.cbrt((pi*(gamma_m**2-gamma_d**2)**3)/((2*gamma_d+gamma_m)**2*(gamma_d-gamma_m)**4))
            beta = np.cbrt((pi*(gamma_d**2-gamma_m**2)**3)/((2*gamma_d+gamma_m)**2*(gamma_d-gamma_m)**4))
            epsilon = np.cbrt((8*pi)/((2+gamma_m/gamma_d)**2*(1-gamma_m/gamma_d)))
            eta = (S_i**(3/2))/(6*pi**(1/2))
        
            C_i = (pi-((sigma*alpha+(sigma-gamma_m)*beta+gamma_d*epsilon)*(np.cbrt(3*V_d)**2-np.cbrt((S_i**(3/2))/(2*np.sqrt(pi))+3*V_d)**2)-(sigma-gamma_m)*S_i-P*eta)/(8*K))/(np.sqrt(pi*S_i))
        
            return C_i
        
        • testing
          x_range = np.logspace(2,7)
          boundary = thermo_spont_C_i(V_d=x_range)
          boundary_test(x_param='V_d', y_param='C_i', x_range=x_range, boundary=boundary,
                        y_offset=0.2)
          
          dfa200386df3634b6222738d978b1475b912a8df.png
          • it doesn't make sense that C_i would ever be negative…
    • local stability parameter analysis [8/8]
      • DONE \(K\)

        from kinetic_spont_k

        def kinetic_spont_K(sigma=sigma, gamma_m=gamma_m, gamma_d=gamma_d,
                          V_d=V_d, S_i=S_i, P=P, C_i=C_i):
        
            alpha = np.cbrt((pi*(gamma_m**2-gamma_d**2)**3)/((2*gamma_d+gamma_m)**2*(gamma_d-gamma_m)**4))
            beta = np.cbrt((pi*(gamma_d**2-gamma_m**2)**3)/((2*gamma_d+gamma_m)**2*(gamma_d-gamma_m)**4))
            epsilon = np.cbrt((8*pi)/((2+gamma_m/gamma_d)**2*(1-gamma_m/gamma_d)))
            eta = (S_i**(3/2))/(6*pi**(1/2))
        
            K = (((sigma*alpha+(sigma-gamma_m)*beta+gamma_d*epsilon)*S_i**(3/2))/(np.sqrt(pi)*np.cbrt(3*V_d)) + 3*P*eta)/(8*C_i*np.sqrt(pi*S_i))
        
            return K
        
        • testing
          x_range = np.logspace(6,9)
          boundary = kinetic_spont_K(V_d=x_range)
          boundary_test(x_param='V_d', y_param='K', x_range=x_range, boundary=boundary,
                        y_offset=0.5)
          
          e4cf69318c7a310e9ff8a21f7763fb6b1f0a5db7.png
      • DONE \(P\)

        from kinetic_spont_p

        def kinetic_spont_P(sigma=sigma, gamma_m=gamma_m, gamma_d=gamma_d,
                          V_d=V_d, S_i=S_i, K=K, C_i=C_i):
        
            alpha = np.cbrt((pi*(gamma_m**2-gamma_d**2)**3)/((2*gamma_d+gamma_m)**2*(gamma_d-gamma_m)**4))
            beta = np.cbrt((pi*(gamma_d**2-gamma_m**2)**3)/((2*gamma_d+gamma_m)**2*(gamma_d-gamma_m)**4))
            epsilon = np.cbrt((8*pi)/((2+gamma_m/gamma_d)**2*(1-gamma_m/gamma_d)))
            eta = (S_i**(3/2))/(6*pi**(1/2))
        
            P = (-((sigma*alpha + (sigma - gamma_m)*beta +gamma_d*epsilon)*S_i**(3/2))/
                 (np.sqrt(pi)*np.cbrt(3*V_d)) + 8*K*C_i*np.sqrt(pi*S_i))/(3*eta)
        
            return P
        
        • testing
          x_range = np.logspace(6,9)
          boundary = kinetic_spont_P(V_d=x_range)
          boundary_test(x_param='V_d', y_param='P', x_range=x_range, boundary=boundary,
                        y_offset=-0.5)
          
          6c852af3a08c192d995a14487626a0d5308a5aaf.png
      • DONE \(\sigma\)
        • testing
          x_range = np.logspace(6,9)
          boundary = kinetic_spont_sigma(V_d=x_range)
          boundary_test(x_param='V_d', y_param='sigma', x_range=x_range, boundary=boundary,
                        y_offset=-0.5)
          
          ---------------------------------------------------------------------------
          TypeError                                 Traceback (most recent call last)
          <ipython-input-122-68222cac32b7> in <module>
                1 x_range = np.logspace(6,9)
          ----> 2 boundary = kinetic_spont_sigma(V_d=x_range)
                3 boundary_test(x_param='V_d', y_param='sigma', x_range=x_range, boundary=boundary,
                4               y_offset=-0.5)
          
          <ipython-input-121-594c148ecf9a> in kinetic_spont_sigma(P, gamma_m, gamma_d, V_d, S_i, K, C_i)
                7     eta = (S_i**(3/2))/(6*pi**(1/2))
                8 
          ----> 9     sigma = (( np.sqrt(pi)/S_i**(3/2) )*np.cbrt(3*V_d)(8*K*C_i*np.sqrt(pi*S_i)-3*P*eta)-
               10              gamma_d*epsilon+gamma_m*beta)/(alpha+beta)
               11 
          
          TypeError: 'numpy.ndarray' object is not callable
          

          :END:

      • DONE \(C_{i}\)

        from kinetic_spont_ci

        def kinetic_spont_C_i(sigma=sigma, gamma_m=gamma_m, gamma_d=gamma_d,
                          V_d=V_d, S_i=S_i, K=K, P=P):
        
            alpha = np.cbrt((pi*(gamma_m**2-gamma_d**2)**3)/((2*gamma_d+gamma_m)**2*(gamma_d-gamma_m)**4))
            beta = np.cbrt((pi*(gamma_d**2-gamma_m**2)**3)/((2*gamma_d+gamma_m)**2*(gamma_d-gamma_m)**4))
            epsilon = np.cbrt((8*pi)/((2+gamma_m/gamma_d)**2*(1-gamma_m/gamma_d)))
            eta = (S_i**(3/2))/(6*pi**(1/2))
        
            C_i = (((sigma*alpha + (sigma - gamma_m)*beta +gamma_d*epsilon)*S_i**(3/2))/
                 (np.sqrt(pi)*np.cbrt(3*V_d)) + 3*P*eta)/(8*K*np.sqrt(pi*S_i))
        
            return C_i
        
        • testing
          x_range = np.logspace(6,9)
          boundary = kinetic_spont_C_i(V_d=x_range)
          boundary_test(x_param='V_d', y_param='C_i', x_range=x_range, boundary=boundary,
                        y_offset=0.5)
          
          8ae3683cfcd331d06dba70c3768ada1f31bc5082.png
      • CANCELLED \(\gamma_m\)
      • CANCELLED \(\gamma_d\)
      • CANCELLED \(S_{i}\)
      • DONE \(V_{d}\)

        from kinetic_spont_ci

        def kinetic_spont_V_d(sigma=sigma, gamma_m=gamma_m, gamma_d=gamma_d,
                          C_i=C_i, S_i=S_i, K=K, P=P):
        
            alpha = np.cbrt((pi*(gamma_m**2-gamma_d**2)**3)/((2*gamma_d+gamma_m)**2*(gamma_d-gamma_m)**4))
            beta = np.cbrt((pi*(gamma_d**2-gamma_m**2)**3)/((2*gamma_d+gamma_m)**2*(gamma_d-gamma_m)**4))
            epsilon = np.cbrt((8*pi)/((2+gamma_m/gamma_d)**2*(1-gamma_m/gamma_d)))
            eta = (S_i**(3/2))/(6*pi**(1/2))
        
            V_d = (1/3)*(((sigma*alpha + (sigma - gamma_m)*beta +gamma_d*epsilon)*S_i**(3/2))/
                 ((8*K*C_i*np.sqrt(pi*S_i)-3*P*eta)*np.sqrt(pi)))**3
        
            return V_d
        
        • testing
          x_range = np.linspace(0.0002, 0.002)
          boundary = kinetic_spont_V_d(P=x_range)
          boundary_test(x_param='P', y_param='V_d', x_range=x_range, boundary=boundary,
                        y_offset=-5, x_scale='linear')
          
          47bdfd0389f80e357a6f2084e80dbce6819748db.png
    • side-by-side F plots with both phase boundaries
      def both_boundary_test(x_param, y_param, x_range, thermo_boundary, kinetic_boundary,
                             params=params, factors=[0.7,1,1.3], y_offset=0.2, x_scale='log', y_scale='linear',
                             variable_df=variable_df):
          fparams = params.copy()
          fig, (ax1, ax2)  = plt.subplots(nrows=1, ncols=2, figsize=(10,4))
      
      
          # if x_scale == 'log':
          #     ax1.semilogx(x_range, thermo_boundary, color='black', label='thermodynamic')
          #     ax1.semilogx(x_range, kinetic_boundary, color='blue', label='kinetic')
          # # else:
          #     ax1.plot(x_range, boundary, color='black')
      
          if y_offset > 0:
              fill_range = np.max(kinetic_boundary)
          if y_offset < 0:
              fill_range = np.min(kinetic_boundary)
      
          ax1.loglog(x_range, thermo_boundary, color='yellow')
          ax1.fill_between(x_range, y1=thermo_boundary, y2=fill_range*1.3, color='yellow', alpha=0.8, label='globally stable')
          ax1.loglog(x_range, kinetic_boundary, color='blue')
          ax1.fill_between(x_range, y1=kinetic_boundary, y2=fill_range*1.3, color='blue', alpha=0.8, label='locally stable')
      
          ax1.legend()
      
          for i, factor in enumerate(factors):
              middle = len(x_range)//2
              x_pick = x_range[middle]*factor
              for j, boundary in enumerate([thermo_boundary, kinetic_boundary]):
                boundary_pick = boundary[middle]+(factor-1)*np.sqrt(thermo_boundary[middle]**2)*y_offset
                fparams[x_param] = x_pick
                fparams[y_param] = boundary_pick
                F = llps_model_recbrt(h=fparams['h_range'], sigma=fparams['sigma'], A_t=fparams['A_t'],
                        S_i=fparams['S_i'], K=fparams['K'], C_i=fparams['C_i'], gamma_d=fparams['gamma_d'],
                        gamma_m=fparams['gamma_m'], gamma_i=fparams['gamma_i'], V_d=fparams['V_d'], P=fparams['P'])
                delta_F = F-F[0]
      
                # ax1.scatter(x_pick, boundary_pick, linewidths=5, color=((j)/2, (j)/2, (j+1)/2, (i+1)/len(factors)))
                # ax2.plot(h_range,delta_F, color=((j)/2, (j)/2, (j+1)/2, (i+1)/len(factors)))
      
                ax1.scatter(x_pick, boundary_pick, linewidths=5)
                ax2.plot(h_range,delta_F)
      
          ax2.hlines(0, -0.05,1.05, color='black')
      
          ax1.set(xlabel=variable_df.loc[x_param]['description']+' ('+variable_df.loc[x_param]['units']+')',
                  ylabel=variable_df.loc[y_param]['description']+' ('+variable_df.loc[y_param]['units']+')')
      #            xscale=x_scale)
          ax1.set_xscale(x_scale)
          ax1.set_yscale(y_scale)
          ax2.set(xlabel='h: relative invagination height', ylabel='∆F ($pN \cdot nm$)')
          plt.tight_layout()
      

result plots [8/9]

  • plot all outputs vs. invagination height for default parameters
    • as individual plots
      outputs = llps_model()
      outputs.pop('theta_d')
      # outputs.pop('2÷R_i')
      variables = list(outputs.keys())
      
      for variable in variables:
          plt.figure()
          plot_simulation(output=variable)
          plt.xlabel('h: invagination distance/vesicle diameter')
          plt.savefig(fig_dir+'%s-vs-H_i.png' %(variable))
      

      2bcaae2bb70a5f6d3cd7d9f720886f53b7b098c3.png 73c40284dde2b788ac50ad17304c206f2ff8ab53.png 23585bd7388e3fcf885463524dff95c8e6ab90ef.png 235f6e3ec56b8727b27b231ca61d469bfe69a045.png 9b228be03256322a7722603cd0805be1b513b49a.png ee217b67de3fd3b64ecffbc147e5c55225fdd2f0.png 9821011cd5fec27581547a1442359ee46695f6d0.png ece5def6bfaf3645baba4bd83d0db58276ef9ef7.png f06824a89d9825bba76ca35a36df6cf1c3f44a5a.png 461dee778bc57c10ff6634bb2e689c63d1e16cc9.png d41e887ffbdcb264344c497b92858dccf65f41f7.png 2a03d989e212796d2f797f8225a83f9a9c55a3bc.png 976c5ed2ff7fedb7473e31700846fe0a20893afe.png 89cdd1bb4f97813c63ae76202d4b9f4f1a907b93.png aad1055a51032dbefe2b046636cd98c3338f9b11.png 9f1fba17ca9725f2e5f08ce2df70da8ee5cb810a.png d089aafb204d59c5c47ab38a127a41c229181911.png

    • as subplots of one figure
      outputs = llps_model()
      outputs.pop('theta_d')
      variables = list(outputs.keys())
      nplots = len(variables)
      width = 3
      height = nplots//3+1
      plt.figure(figsize=(width*5,height*4))
      
      for i, variable in enumerate(variables):
          plt.subplot(height, width, i+1)
          plot_simulation(output=variable)
          plt.xlabel('h: invagination distance/vesicle diameter')
      
      plt.tight_layout()
      plt.savefig(fig_dir+'all_outputs.png')
      
      3f9e8f97c5cee3d83f97928599a1e69e2e3a4707.png
  • change in all outputs vs. invagination height for default parameters
    • as individual plots
      outputs = llps_model()
      outputs.pop('theta_d')
      variables = outputs.keys()
      
      for variable in variables:
          plt.figure()
          plot_simulation_delta(output=variable)
          plt.tight_layout()
          plt.savefig(fig_dir+'%s-vs-H_i_delta.png' %(variable))
      

      0a5128988c1cc0fd1077e67cecce7bc85198afea.png 8aab118534e41198504a7b16104a7ea1a9202d4e.png 2b08afa1fd9a9ab0c8e4c62d75b4c91691d9cd9a.png a5381559e37627e5d3b1a22d9dff648b71b98229.png 91f06409b34bc48e22c0ca48dc458231eff066d2.png 5e806ce2c0adde222a5547a1f66aade5fa0e4f5e.png f5f1c9a169c4aeac506a52200f3f2c3308cc0dfb.png da63f6e19f7d481c2659f9caaa13f6ef6bafc576.png 184eedb0e71c1a55085ccb32bec4863311054dfa.png 6a9aae755bfe2b178d0a31e6c1871c8806ae1fb0.png a06f1a5d6aa86e5c88d194d79b10bbca450e031c.png 99cb6d32331bb3d1cb2944d41214623d7a8d857c.png 195a1f76d402aaa2091ad27d2f4193e789a7ea03.png 1f4e4c03ce722a09b083fc719afd43ec961d975e.png 81eab990b18dac5aab5efaff7ba7cedf48624ad4.png 7a9e81de9d2d73b442a332ea306052226e8411cc.png b976297d7731cfc494beef6fa9fd085edcdc2f7a.png

    • as subplots of one figure
      outputs = llps_model()
      outputs.pop('theta_d')
      variables = outputs.keys()
      nplots = len(variables)
      width = 3
      height = nplots//3+1
      plt.figure(figsize=(width*5,height*4))
      
      for i, variable in enumerate(variables):
          plt.subplot(height, width, i+1)
          plot_simulation_delta(output=variable)
      
      plt.tight_layout()
      plt.savefig(fig_dir+'all_outputs_delta.png')
      
      80e2d75f6548b3e4200bcbc29ea753bbf8776e60.png
  • change in surface areas
    variables = ['S_o', 'S_d', 'S_m']
    
    for variable in variables:
        plot_simulation_delta(output=variable, label=variable)
        plt.ylabel('∆ surface area')
        plt.legend()
        plt.tight_layout()
        plt.savefig(fig_dir+'areas-vs-H_i_delta.png')
    
    e9c2b8a3b5c9afcae737f31318e42c5a36f72999.png
  • each individual energy term output
    • set temporary variables
      P_temp = 1e-3
      gamma_d_temp = gamma_d*10
      gamma_m_temp = gamma_m*10
      K_temp = 160
      
    • normal droplet
      show_geometry(H_i=100)
      plt.savefig(fig_dir+'normal_droplet.png')
      
      dc1240c7e73de4aaa6b4c168b30fcd0ff3844e07.png
      • with appropriate signs

        droplet only:

        variables = ['surface_tension', 'wetting_energy', 'droplet_energy']
        colors = ['blue', 'green', 'black']
        
        plt.figure(figsize=(6,6))
        
        for variable, color in zip(variables, colors):
            plot_simulation_delta(output=variable, label=variable, P=P_temp, gamma_d=gamma_d_temp,
                                  gamma_m=gamma_m_temp, K=K_temp, color=color)
        
        plt.legend()
        #plt.ylim(-100, 100)
        plt.ylabel('∆ energy (pN * nm)')
        #plt.title(title)
        plt.tight_layout()
        plt.savefig(fig_dir+'droplet_energy_contributions.png')
        plt.savefig(fig_dir+'droplet_energy_contributions.svg')
        
        561066d087aa8261d884357ea4b340fdc0baedbd.png

        all contributions:

        variables = ['surface_tension', 'wetting_energy', 'droplet_energy',
                     'membrane_tension', 'bending_energy', 'turgor_pressure', 'F']
        colors = ['blue', 'green', 'black',
                  'red', 'purple', 'brown', 'orange']
        
        plt.figure(figsize=(6,6))
        
        for variable, color in zip(variables, colors):
            plot_simulation_delta(output=variable, label=variable, P=P_temp, gamma_d=gamma_d_temp,
                                  gamma_m=gamma_m_temp, K=50, color=color)
        
        plt.legend()
        #plt.ylim(-100, 100)
        plt.ylabel('∆ energy (pN * nm)')
        #plt.title(title)
        plt.tight_layout()
        plt.savefig(fig_dir+'energy_contributions.png')
        plt.savefig(fig_dir+'energy_contributions.svg')
        
        ca5adb4bc7e39e5d3c954ac2ba3192da06fd096f.png
      • flipped sign of negative energy contributions
        variables = ['membrane_tension', 'bending_energy_flipped','surface_tension',
                      'wetting_energy_flipped', 'turgor_pressure']
        
        plt.figure(figsize=(10,10))
        
        for variable in variables:
            plot_simulation_delta(output=variable, label=variable, P=P_temp, gamma_d=gamma_d_temp,
                                  gamma_m=gamma_m_temp, K=K_temp)
        plt.legend()
        #plt.ylim(-100, 100)
        plt.ylabel('∆ energy (pN * nm)')
        #plt.title(title)
        plt.tight_layout()
        plt.savefig(fig_dir+'energy_contributions_flipped.png')
        
        006bb289748fa11eff88e653126657a42086c598.png
    • huge droplet
      show_geometry(H_i=100, V_d=V_d*10**4,
                    left=-3600, right=3600, bottom=-2300)
      plt.savefig(fig_dir+'bigdrop.png')
      
      d548ff9962ce257e7f0d4d78e1fad4e9a6c1cc09.png
      • with appropriate signs
        variables = ['surface_tension', 'wetting_energy', 'droplet_energy']
        colors = ['blue', 'green', 'black']
        
        plt.figure(figsize=(6,6))
        
        for variable, color in zip(variables, colors):
            plot_simulation_delta(output=variable, label=variable, P=P_temp, gamma_d=gamma_d_temp,
                                  gamma_m=gamma_m_temp, K=K_temp, V_d=V_d*10**4, color=color)
        plt.legend()
        #plt.ylim(-100, 100)
        plt.ylabel('∆ energy (pN * nm)')
        #plt.title(title)
        plt.tight_layout()
        plt.savefig(fig_dir+'droplet_energy_contributions_bigdrop.png')
        plt.savefig(fig_dir+'droplet_energy_contributions_bigdrop.svg')
        
        db3e36d09f5fdc9679496495cbdb0531eab8ed26.png
      • flipped sign of negative energy contributions
        variables = ['membrane_tension', 'bending_energy_flipped','surface_tension',
                      'wetting_energy_flipped', 'turgor_pressure']
        
        plt.figure(figsize=(10,10))
        
        for variable in variables:
            plot_simulation_delta(output=variable, label=variable, P=P_temp, gamma_d=gamma_d_temp,
                                  gamma_m=gamma_m_temp, K=K_temp, V_d=V_d*10**4)
        plt.legend()
        #plt.ylim(-100, 100)
        plt.ylabel('∆ energy (pN * nm)')
        #plt.title(title)
        plt.tight_layout()
        plt.savefig(fig_dir+'energy_contributions_bigdrop_flipped.png')
        
        6cc2bad9a6422e5faa6fc6d36227db442a33a407.png
  • Plot F for a series of values of gamma_m

    What are the parameter values? I assume that gamma_m is negative. Plot F for a series of values of gamma_m. Based on the plots for S_m, S_d, and S_0, F should end up with a minimum at H/R=1 if gamma_m is large enough. It might also happen if gamma_d is small enough. It's hard to say because I can't easily compare the magnitude of changes in S_d, S_i, and S_0.

    • absolute
      gamma_m_range = [0,50,100,150,199]
      
      for i in gamma_m_range:
          plot_simulation(gamma_m=i, label=i/gamma_d)
      
      plt.legend(title='gamma_m/gamma_d')
      plt.xlabel('invagination distance/vesicle diameter')
      plt.tight_layout()
      plt.savefig(fig_dir+'f_scan_gamma_m.png')
      
      <ipython-input-7-3ad17b48a703>:6: RuntimeWarning: invalid value encountered in arccos
        theta_d = np.arccos(gamma_m/gamma_d) #equation 8
      <ipython-input-7-3ad17b48a703>:6: RuntimeWarning: invalid value encountered in arccos
        theta_d = np.arccos(gamma_m/gamma_d) #equation 8
      <ipython-input-7-3ad17b48a703>:6: RuntimeWarning: invalid value encountered in arccos
        theta_d = np.arccos(gamma_m/gamma_d) #equation 8
      <ipython-input-7-3ad17b48a703>:6: RuntimeWarning: invalid value encountered in arccos
        theta_d = np.arccos(gamma_m/gamma_d) #equation 8
      
      251d320215ce964a1d23ef1abd8347adddcd9873.png
    • normalized
      gamma_m_range = [0,50,100,150,199]
      
      for i in gamma_m_range:
          plot_simulation_normalized(gamma_m=i, label=i/gamma_d)
      
      plt.legend(title='gamma_m/gamma_d')
      plt.xlabel('invagination distance/vesicle diameter')
      plt.tight_layout()
      plt.savefig(fig_dir+'f_scan_gamma_m.png')
      
      <ipython-input-7-3ad17b48a703>:6: RuntimeWarning: invalid value encountered in arccos
        theta_d = np.arccos(gamma_m/gamma_d) #equation 8
      <ipython-input-7-3ad17b48a703>:6: RuntimeWarning: invalid value encountered in arccos
        theta_d = np.arccos(gamma_m/gamma_d) #equation 8
      <ipython-input-7-3ad17b48a703>:6: RuntimeWarning: invalid value encountered in arccos
        theta_d = np.arccos(gamma_m/gamma_d) #equation 8
      <ipython-input-7-3ad17b48a703>:6: RuntimeWarning: invalid value encountered in arccos
        theta_d = np.arccos(gamma_m/gamma_d) #equation 8
      
      6e570113298eaeacf47b71d75a671717c9eb4e2e.png

      :end:

    • delta
      gamma_m_range = np.array( [0.01,0.25,0.5,0.75] )*gamma_d
      
      for i in gamma_m_range:
          plot_simulation_delta(gamma_m=i, label=i/gamma_d)
      
      plt.legend(title='$\gamma_{m}/\gamma_{d}$')
      plt.tight_layout()
      plt.savefig(fig_dir+'f_scan_gamma_m_delta.png')
      
      a60b2c02931b7f50512a91322d36e23bd0489771.png
    • delta and geometry side by side
      gamma_m_range = [0,50,100,150,180]
      
      for i in gamma_m_range:
          plot_simulation_geometry(gamma_m=i, label=i/gamma_d)
          plt.legend(title='$\gamma_{m}/\gamma_{d}$')
          plt.tight_layout()
          plt.savefig(fig_dir+'f_scan_gamma_m_%s.png' %(i))
      
      <ipython-input-7-3ad17b48a703>:6: RuntimeWarning: invalid value encountered in arccos
        theta_d = np.arccos(gamma_m/gamma_d) #equation 8
      /usr/local/Caskroom/miniconda/base/envs/llps_model_analysis/lib/python3.9/site-packages/numpy/core/_asarray.py:83: UserWarning: Warning: converting a masked element to nan.
        return array(a, dtype, copy=False, order=order)
      <ipython-input-7-3ad17b48a703>:6: RuntimeWarning: invalid value encountered in arccos
        theta_d = np.arccos(gamma_m/gamma_d) #equation 8
      <ipython-input-7-3ad17b48a703>:6: RuntimeWarning: invalid value encountered in arccos
        theta_d = np.arccos(gamma_m/gamma_d) #equation 8
      /usr/local/Caskroom/miniconda/base/envs/llps_model_analysis/lib/python3.9/site-packages/numpy/core/_asarray.py:83: UserWarning: Warning: converting a masked element to nan.
        return array(a, dtype, copy=False, order=order)
      <ipython-input-7-3ad17b48a703>:6: RuntimeWarning: invalid value encountered in arccos
        theta_d = np.arccos(gamma_m/gamma_d) #equation 8
      <ipython-input-7-3ad17b48a703>:6: RuntimeWarning: invalid value encountered in arccos
        theta_d = np.arccos(gamma_m/gamma_d) #equation 8
      /usr/local/Caskroom/miniconda/base/envs/llps_model_analysis/lib/python3.9/site-packages/numpy/core/_asarray.py:83: UserWarning: Warning: converting a masked element to nan.
        return array(a, dtype, copy=False, order=order)
      <ipython-input-7-3ad17b48a703>:6: RuntimeWarning: invalid value encountered in arccos
        theta_d = np.arccos(gamma_m/gamma_d) #equation 8
      <ipython-input-7-3ad17b48a703>:6: RuntimeWarning: invalid value encountered in arccos
        theta_d = np.arccos(gamma_m/gamma_d) #equation 8
      /usr/local/Caskroom/miniconda/base/envs/llps_model_analysis/lib/python3.9/site-packages/numpy/core/_asarray.py:83: UserWarning: Warning: converting a masked element to nan.
        return array(a, dtype, copy=False, order=order)
      <ipython-input-7-3ad17b48a703>:6: RuntimeWarning: invalid value encountered in arccos
        theta_d = np.arccos(gamma_m/gamma_d) #equation 8
      

      6462d186e7e67b48545aa7e42a964814ae14beca.png 47486545ffb5778b7bb4d466f146394f948ae119.png 3a4f99dfba1466623492d07043b624ba8d1c681a.png a2d43c7184c60ce612ac1f497d7ea473ec383a51.png 28c26346adc7c9f4a7e2c794c84fe02b222f5741.png

  • F over series of turgor pressure
    pressure_range = np.linspace(10**-2,1,5)
    
    for i in pressure_range:
        plot_simulation_delta(P=i, label=i)
    
    plt.legend(title='turgor pressure ($N/nm^{2}$)')
    plt.tight_layout()
    plt.savefig(fig_dir+'f_scan_turgor_delta.png')
    
    d9ce597d421ffa065f6d13e6643381e174b76c1c.png
  • spontaneity analysis

    there's no solution for kinetic \(\sigma\)

    • DONE \(V_{d}\) x-axis
      boundaries = [(thermo_spont_K,kinetic_spont_K, 'K', 2),
                    (thermo_spont_P,kinetic_spont_P, 'P', -2),
                    #(thermo_spont_sigma,kinetic_spont_sigma, 'sigma'),
                    (thermo_spont_C_i,kinetic_spont_C_i, 'C_i', 2)]
      x_range = np.logspace(7,9,base=10)
      for thermo_boundaryy, kinetic_boundaryy, y_param, y_offset in boundaries:
          thermo_boundary = thermo_boundaryy(V_d=x_range)
          kinetic_boundary = kinetic_boundaryy(V_d=x_range)
          both_boundary_test(x_param='V_d', y_param=y_param, x_range=x_range,
                          thermo_boundary=thermo_boundary, kinetic_boundary=kinetic_boundary,
                          y_offset=y_offset/2, factors=[0.9,1,1.1])
          plt.savefig(fig_dir+y_param+'V_d_boundary_check.png')
      

      65ba6117df9694fcbad30a1046dfecdb2c257d41.png fa88cd1ae50969bfacee7b577b140af204b654f9.png 567102d0d44ac46c20f4b184996553f276ad06bd.png

      show_geometry(H_i=100, V_d=10**(7))
      plt.savefig(fig_dir+'10e7_geometry.png')
      
      89e844cc38a76604a4a2bb5514d8aff005cef79b.png
      show_geometry(H_i=100, V_d=10**(9), left=-1200, right=1200, bottom=-600)
      plt.savefig(fig_dir+'10e9_geometry.png')
      
      dbb38358797f6b2b639bb1379d44b169578b65b3.png
    • DONE \(\gamma_{d}\) x-axis
      boundaries = [(thermo_spont_K,kinetic_spont_K, 'K', 2),
                    (thermo_spont_P,kinetic_spont_P, 'P', -2),
                    #(thermo_spont_sigma,kinetic_spont_sigma, 'sigma'),
                    (thermo_spont_C_i,kinetic_spont_C_i, 'C_i', 2)]
      x_range = np.logspace(-4,-1,base=10)
      for thermo_boundaryy, kinetic_boundaryy, y_param, y_offset in boundaries:
          thermo_boundary = thermo_boundaryy(gamma_d=x_range)
          kinetic_boundary = kinetic_boundaryy(gamma_d=x_range)
          both_boundary_test(x_param='gamma_d', y_param=y_param, x_range=x_range,
                          thermo_boundary=thermo_boundary, kinetic_boundary=kinetic_boundary,
                          y_offset=y_offset/2, factors=[0.9,1,1.1])
          plt.savefig(fig_dir+y_param+'gamma_d_boundary_check.png')
      

      6cc97f36dd06b88d6cebab05fd7138c2fabec7e4.png 984e126283b2f9070d6ba6d80ded5332647b18be.png bb83131b8242be061b1aba8673800328c56e8428.png

    • DONE \(\gamma_{m}\) x-axis
      boundaries = [(thermo_spont_K,kinetic_spont_K, 'K', 2),
                    (thermo_spont_P,kinetic_spont_P, 'P', -2),
                    #(thermo_spont_sigma,kinetic_spont_sigma, 'sigma'),
                    (thermo_spont_C_i,kinetic_spont_C_i, 'C_i', 2)]
      x_range = np.logspace(-4,-1,base=10)
      for thermo_boundaryy, kinetic_boundaryy, y_param, y_offset in boundaries:
          thermo_boundary = thermo_boundaryy(gamma_m=x_range)
          kinetic_boundary = kinetic_boundaryy(gamma_m=x_range)
          both_boundary_test(x_param='gamma_m', y_param=y_param, x_range=x_range,
                          thermo_boundary=thermo_boundary, kinetic_boundary=kinetic_boundary,
                          y_offset=y_offset*2, factors=[0.8,1,1.2])
          plt.savefig(fig_dir+y_param+'gamma_m_boundary_check.png')
      

      2767bdbac987199f7030d43be11dc7cdabac7cf3.png ba2373671cc8500e5fcc09ab8261f847b4a8cf45.png 715e736e02880dd6755fdbdcc886399d7112a7e5.png

    • TODO \(\gamma_{m}\) /\(\gamma_{d}\) x-axis
      boundaries = [(thermo_spont_K,kinetic_spont_K, 'K', 2),
                    (thermo_spont_P,kinetic_spont_P, 'P', -2),
                    #(thermo_spont_sigma,kinetic_spont_sigma, 'sigma'),
                    (thermo_spont_C_i,kinetic_spont_C_i, 'C_i', 2)]
      x_range = np.logspace(-2,0.0001,base=10)*gamma_d
      for thermo_boundaryy, kinetic_boundaryy, y_param, y_offset in boundaries:
          thermo_boundary = thermo_boundaryy(gamma_m=x_range)
          kinetic_boundary = kinetic_boundaryy(gamma_m=x_range)
          both_boundary_test(x_param='gamma_m', y_param=y_param, x_range=x_range,
                          thermo_boundary=thermo_boundary, kinetic_boundary=kinetic_boundary,
                          y_offset=y_offset/2, factors=[0.8,1,1.2])
          plt.savefig(fig_dir+y_param+'gamma_m_relative_boundary_check.png')
      

      258ac3c3dc1ee5116e9f854e6110318b8b3a4f72.png 56e5e90eb06ab1caa3b23cb2866776a606f4c46a.png 6058ac26b1ef2f42ca5fc11f0166204e4072c412.png

    • DONE \(\sigma\) x-axis
      boundaries = [(thermo_spont_K,kinetic_spont_K, 'K', -2),
                    (thermo_spont_P,kinetic_spont_P, 'P', 2),
                    (thermo_spont_C_i,kinetic_spont_C_i, 'C_i', -2)]
      x_range = np.logspace(-5,-1,base=10)
      for thermo_boundaryy, kinetic_boundaryy, y_param, y_offset in boundaries:
          thermo_boundary = thermo_boundaryy(sigma=x_range)
          kinetic_boundary = kinetic_boundaryy(sigma=x_range)
          both_boundary_test(x_param='sigma', y_param=y_param, x_range=x_range,
                          thermo_boundary=thermo_boundary, kinetic_boundary=kinetic_boundary,
                          y_offset=y_offset/5, factors=[0.8,1,1.2])
          plt.savefig(fig_dir+y_param+'sigma_boundary_check.png')
      

      0cc8731998e4ad151c85f1fd420f6314b90cdd53.png 5a5f45ca0b6ece0d454b27b7ef64856959fa9538.png a916aa303d51ec1b24462831f1d620c826d3c978.png

    • DONE \(S_{i}\) x-axis
      boundaries = [(thermo_spont_K,kinetic_spont_K, 'K', 2),
                    (thermo_spont_P,kinetic_spont_P, 'P', -2),
                    (thermo_spont_C_i,kinetic_spont_C_i, 'C_i', 2)]
      x_range = np.logspace(3.5,4.5,base=10)
      for thermo_boundaryy, kinetic_boundaryy, y_param, y_offset in boundaries:
          thermo_boundary = thermo_boundaryy(S_i=x_range)
          kinetic_boundary = kinetic_boundaryy(S_i=x_range)
          both_boundary_test(x_param='S_i', y_param=y_param, x_range=x_range,
                          thermo_boundary=thermo_boundary, kinetic_boundary=kinetic_boundary,
                          y_offset=y_offset*50, factors=[0.999,1,1.001])
          plt.savefig(fig_dir+y_param+'S_i_boundary_check.png')
      

      c5f11526b60a9b6da37178de779f0cec2fae9c52.png 9f61ad6cea08c32b2f3a9aa858dcc20af2edd33c.png f2cd6de8326702e0be621e11ec81b62d2fd1bcd7.png

    • DONE \(P\) x-axis
      boundaries = [(thermo_spont_K,kinetic_spont_K, 'K', 2),
                    #(thermo_spont_P,kinetic_spont_P, 'P', 2),
                    (thermo_spont_C_i,kinetic_spont_C_i, 'C_i', 2)]
      x_range = np.logspace(-3,0,base=10)
      for thermo_boundaryy, kinetic_boundaryy, y_param, y_offset in boundaries:
          thermo_boundary = thermo_boundaryy(P=x_range)
          kinetic_boundary = kinetic_boundaryy(P=x_range)
          both_boundary_test(x_param='P', y_param=y_param, x_range=x_range,
                          thermo_boundary=thermo_boundary, kinetic_boundary=kinetic_boundary,
                          y_offset=y_offset*150, factors=[0.999,1,1.001])
          plt.savefig(fig_dir+y_param+'P_boundary_check.png')
      

      87fb4db718f01e5714b1ad4006cf2488cf99d621.png 452e33f681d06561a1dcb3c35ca0c43de50c6009.png

    • DONE \(C_{i}\) x-axis
      boundaries = [(thermo_spont_K,kinetic_spont_K, 'K', 2),
                    (thermo_spont_P,kinetic_spont_P, 'P', -2)]
      x_range = np.logspace(-4,-1,base=10)
      for thermo_boundaryy, kinetic_boundaryy, y_param, y_offset in boundaries:
          thermo_boundary = thermo_boundaryy(C_i=x_range)
          kinetic_boundary = kinetic_boundaryy(C_i=x_range)
          both_boundary_test(x_param='C_i', y_param=y_param, x_range=x_range,
                          thermo_boundary=thermo_boundary, kinetic_boundary=kinetic_boundary,
                          y_offset=y_offset/5, factors=[0.8,1,1.2])
          plt.savefig(fig_dir+y_param+'C_i_boundary_check.png')
      

      0156dbd6ed414abd7ba08685c859e2c5840ea784.png ed11232b216463c405702c2d707f99b85b33f232.png

    • DONE \(K\) x-axis
      boundaries = [(thermo_spont_C_i,kinetic_spont_C_i, 'C_i', 2),
                    (thermo_spont_P,kinetic_spont_P, 'P', -2)]
      x_range = np.logspace(1,4,base=10)
      for thermo_boundaryy, kinetic_boundaryy, y_param, y_offset in boundaries:
          thermo_boundary = thermo_boundaryy(K=x_range)
          kinetic_boundary = kinetic_boundaryy(K=x_range)
          both_boundary_test(x_param='K', y_param=y_param, x_range=x_range,
                          thermo_boundary=thermo_boundary, kinetic_boundary=kinetic_boundary,
                          y_offset=y_offset/1, factors=[0.9,1,1.1])
          plt.savefig(fig_dir+y_param+'K_boundary_check.png')
      

      8b69a908af8af6ca2d3dae47be3a54ca31b88776.png 3e4342aa08761e2dc11b17a500cc7fcd808dba9a.png

  • plots for 20200915 lab meeting drafting
    • TODO each individual energy term output
      variables = ['membrane_tension',
                    'bending_energy','surface_tension',
                    'wetting_energy','turgor_pressure']
      
      for variable in variables:
          plt.figure()
          plot_simulation_delta(output=variable)
          plt.tight_layout()
          plt.savefig(fig_dir+'%s-vs-H_i_delta.png' %(variable))
      
      67951faa63202a353880478d30043157eeaa86be.png
    • membrane components without droplet
      • effect of membrane tension alone
        plot_simulation_geometry(V_d=0, K=0, gamma_m=0, gamma_i=0, P=0)
        
        33f0c1280edf5be0ec62ca4e853e68b028415410.png
      • effect of bending energy alone
        plot_simulation_geometry(K=K, V_d=0, sigma=0, gamma_m=0, gamma_i=0, P=0)
        
        96eea197f56156d4bfe2d2ffce1cdbc62280f3f0.png
        • TODO fix this

          why is this different from plotting membrane bending energy term alone?

          R_i_range = np.linspace(0.1,np.pi,100)
          bending_energy = (K/2)*S_i*((2/R_i_range)-C_i)**2
          plt.plot(R_i_range, bending_energy)
          
          <matplotlib.lines.Line2D at 0x159e3c430>
          837e85a1c8f421f9d96cbd477b15d0bf46cff805.png
    • droplet effects
      • surface tension
        plot_simulation_geometry(sigma=0, K=0, gamma_m=0, gamma_i=0, P=0)
        
        c9a52aa61350b6e13e5bc5001b7b3fdef06b2809.png
      • surface tension + wetting energy

        can't have wetting energy alone

        plot_simulation_geometry(sigma=0, K=0, P=0)
        
        c147c16a1be0becdcede197eef996043f8488b6c.png
    • TODO droplet+membrane effects
    • TODO turgor pressure effects

Author: Max Ferrin

Created: 2023-01-04 Wed 18:05

Validate